Skip to content

Cannot produce outlines for TrueType fonts with 65536 glyphs #213

@laurmaedje

Description

@laurmaedje

For TrueType fonts with the maximum number of glyphs, the code below early returns because the range of u16 is exceeded, leading to loca table parsing failing:

let actual_total = match format {
IndexToLocationFormat::Short => data.len() / 2,
IndexToLocationFormat::Long => data.len() / 4,
};
let actual_total = u16::try_from(actual_total).ok()?;

This in turn means that no outlines can be produced.

Having the maximum number of glyphs is not that uncommon in CJK fonts, e.g. Source Han Sans or Noto Serif CJK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions