Skip to content

CFF/CFF2 Index read/write with count=0 #1719

@behdad

Description

@behdad

The OT spec has the following note:

An empty INDEX is represented by a count field with a 0 value and no additional fields. Thus, the total size of an empty INDEX is 4 bytes.

Is this implemented?

https://learn.microsoft.com/en-us/typography/opentype/spec/cff2#common-formats-dict-and-index

The same goes for CFF-1 Index as well. Looks like we read/write Index1 / Index2 fully (offSize, offsets array) even if count is 0:

https://github.com/googlefonts/fontations/blob/main/resources/codegen_inputs/postscript.rs

For writing, this just writes a couple of extra unnecessary bytes. But for read, this can err when the data is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodegen

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions