stegosphere.containers.font package

Submodules

stegosphere.containers.font.ttf module

Module for interacting with ttf files.

class stegosphere.containers.font.ttf.TTFContainer(font)

Bases: Container

File container for TrueType Font files.

flush(glyphs)

Flush new glyphs into container.

Parameters:

glyphs (iterable) – List of glyphs

Returns:

None

read()

Read glyphs.

save(path, flush=None, close_file=True)

Save font

stegosphere.containers.font.ttf_CustomTable module

Creating/reading a custom table within a ttf file.

stegosphere.containers.font.ttf_CustomTable.embed(font, payload, table_name)

Create new table in ttf file.

Parameters:
  • font (stegosphere.font.ttf.TTFContainer) – Font object

  • payload (str | bytes) – Payload to write into table

  • table_name (str) – 4-character table tag

Returns:

Updated font object

Return type:

stegosphere.font.ttf.TTFContainer

Raises:

ValueError – If table_name is not 4 characters long

Warns:

UserWarning – If table_name already exists, thus data will be overwritten

stegosphere.containers.font.ttf_CustomTable.extract(font, table_name)

Extract table from ttf file.

Parameters:
  • font (stegosphere.font.ttf.TTFContainer) – Font object

  • table_name (str) – Table to read

Returns:

table data or None, if table_name not in font

Raises:

ValueError – If table_name is not 4 characters long

Module contents

class stegosphere.containers.font.TTFContainer(font)

Bases: Container

File container for TrueType Font files.

flush(glyphs)

Flush new glyphs into container.

Parameters:

glyphs (iterable) – List of glyphs

Returns:

None

read()

Read glyphs.

save(path, flush=None, close_file=True)

Save font