Skip to content

Suggestion: add Freetype bearing measurements to glyph_info #154

@dmurdoch

Description

@dmurdoch

To render text properly in rgl using textshaping and systemfonts to handle text rendering., I need the metrics.horiBearingX and metrics.horiBearingY values returned by FT_Load_Glyph. As far as I can see, that's the only reason I would need to link Freetype into rgl. Would it be possible for systemfonts to add those measurements to the (C-level) glyph_metrics() output?

Another way to do this would be to incorporate those values into the loc result (or a new result) returned by string_shape() in the textshaping package.

That would simplify the linking requirements for rgl, and avoid the need to check that the FreeType version matches the one linked into systemfonts.

It's possible I've just missed something in the C interfaces to systemfonts and textshaping. Here's the process I am currently trying to use for rendering a string like "abg":

  1. Get the bitmaps for each glyph using get_glyph_raster from systemfonts.
  2. Use string_shape from textshaping to find the positions of each glyph in the output.
  3. Use get_cached_face from systemfonts and FT_Load_Glyph to get the bearings for each glyph.
  4. Display the bitmaps for each glyph by combining the loc valutes from string_shape with the bearings.

BTW, it would be nice if there was an alternative to get_glyph_raster that just returned the image in a buffer so I didn't need to decode the SEXP, but It's mostly just step 3 that I'd like to be able to avoid.

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