Skip to content

getGlyphInfos() getGlyphPositions(): make private properties public? #169

@justvanrossum

Description

@justvanrossum

The objects in the arrays returned by getGlyphInfos() and getGlyphPositions() contain private properties: mask, var1, var2 and var respectively.

This makes these object cumbersome to work with in some cases. For example, in Fontra I want a single object per glyph, representing both glyph infos and positioning. I naively thought of doing that like this:

    const glyphInfos = buffer.getGlyphInfos();
    const glyphPositions = buffer.getGlyphPositions();
    const glyphs = [];
    for (let i = 0; i < glyphInfos.length; i++) {
      glyphs.push({ ...glyphInfos[i], ...glyphPositions[i] });
    }

But that doesn't work for the private properties (that I need), because they are not enumerated with the spread syntax.

Ideally I'd really want a combined getGlyphInfos()/getGlyphPositions() api, equivalent to buffer.json(), but including the private fields. But even doing that externally is currently harder than needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions