vfbLib.vfb.entry.VfbEntry

class vfbLib.vfb.entry.VfbEntry(parent: Vfb, parser: type[BaseParser] | None = None, compiler: type[BaseCompiler] | None = None, eid: int | None = None)

Bases: StreamReader

__init__(parent: Vfb, parser: type[BaseParser] | None = None, compiler: type[BaseCompiler] | None = None, eid: int | None = None) None

Methods

__init__(parent[, parser, compiler, eid])

as_dict([minimize])

clean()

Reset the entry to its original, un-decompiled state.

compile([force])

Compile the entry.

decompile()

Decompile the entry.

merge_masters_data()

Merge any temporary masters data into the main decompiled structure.

read(stream)

Read the entry from the stream without decompiling the data.

read_double()

Return a double-precision float from the stream.

read_doubles(num)

Return a tuple of num double-precision floats from the stream.

read_float()

Return a float from the stream.

read_floats(num)

Return a tuple of num floats from the stream.

read_int16()

Return a signed 16-bit integer from the stream.

read_int32()

Return a signed 32-bit integer from the stream.

read_int8()

Return a signed 8-bit integer from the stream.

read_str(size)

Return a string of the specified size from the current stream with the current encoding

read_str_all()

Return the remaining bytes of the current stream as a string with the current encoding.

read_uint16()

Return an unsigned 16-bit integer from the stream.

read_uint32()

Return an unsigned 32-bit integer from the stream.

read_uint8()

Return an unsigned 8-bit integer from the stream.

read_value([signed])

Return an encoded integer value from the stream.

store_hash()

Store a hash of the decompiled data.

Attributes

current_hash

data

decompiled

encoding

header

The entry header.

id

modified

size

The size of the compiled data.

stream

clean() None

Reset the entry to its original, un-decompiled state.

compile(force=False) None

Compile the entry. The result is stored in VfbEntry.data.

decompile() None

Decompile the entry. The result is stored in VfbEntry.decompiled.

property header: bytes

The entry header.

Returns:

The data of the current entry header.

Return type:

bytes

merge_masters_data() None

Merge any temporary masters data into the main decompiled structure. Such data can be added as the result of drawing with a PointPen into a multiple master Vfb.

read(stream: BufferedReader) None

Read the entry from the stream without decompiling the data.

read_double() float

Return a double-precision float from the stream.

Returns:

The float

Return type:

float

read_doubles(num) tuple[float]

Return a tuple of num double-precision floats from the stream.

Parameters:

num (int) – The number of double-precision floats to read from the stream

Returns:

The tuple of floats

Return type:

tuple[float]

read_float() float

Return a float from the stream.

Returns:

The float

Return type:

float

read_floats(num: int) tuple[float]

Return a tuple of num floats from the stream.

Parameters:

num (int) – The number of floats to read from the stream

Returns:

The tuple of floats

Return type:

tuple[float]

read_int16() int

Return a signed 16-bit integer from the stream.

Returns:

The integer

Return type:

int

read_int32() int

Return a signed 32-bit integer from the stream.

Returns:

The integer

Return type:

int

read_int8() int

Return a signed 8-bit integer from the stream.

Returns:

The integer

Return type:

int

read_str(size: int) str

Return a string of the specified size from the current stream with the current encoding

Parameters:

size (int) – The size in bytes to be converted to a string

Returns:

The string

Return type:

str

read_str_all() str

Return the remaining bytes of the current stream as a string with the current encoding. Null bytes and whitespace are stripped from the string.

Returns:

The string

Return type:

str

read_uint16() int

Return an unsigned 16-bit integer from the stream.

Returns:

The integer

Return type:

int

read_uint32() int

Return an unsigned 32-bit integer from the stream.

Returns:

The integer

Return type:

int

read_uint8() int

Return an unsigned 8-bit integer from the stream.

Returns:

The integer

Return type:

int

read_value(signed: bool = True) int

Return an encoded integer value from the stream.

Parameters:
  • signed (bool, optional) – Whether the value is interpreted as a signed value.

  • True. (Defaults to)

Returns:

The integer

Return type:

int

property size: int

The size of the compiled data.

Returns:

The size of the current compiled data.

Return type:

int

store_hash() None

Store a hash of the decompiled data. Can be used to track any changes.