freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using the image cache.


From: Brian McGee
Subject: Using the image cache.
Date: Tue, 23 Nov 2021 09:11:32 -0600
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1

Hi,


I'm using FreeType for an engine that renders text on demand.  To make this as efficient as possible I'm using the cache API for all my rendering.  I'm calling FTC_ImageCache_LookupScaler to get my FT_Glyph, and using FT_Glyph.advance.x to move the cursor to the next start.


I'm having a problem, however, rendering certain text for SOME fonts.  For instance, Anonymous Pro (https://fonts.google.com/specimen/Anonymous+Pro?query=Anonymous). The issue can be seen when rendering text like "MAIL."  I get a big gap between the M and the A.

Investigating this with FontForge, the issue appears to be that the A has a negative left-side bearing.  If I adjust the cursor position by this amount before I render the A, everything looks perfect.


My issue, however, is that the left side bearing isn't available in an FT_Glyph.  It's only available, it seems (as horiBearingX) in the FT_Face.glyph.metrics (FT_Glyph_Metrics) structure.  And that's not getting updated when I'm loading a glyph from the cache.


What's the best way to deal with this issue?


Thanks,


Brian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]