summaryrefslogtreecommitdiff
path: root/src/truetype/ttgload.c
diff options
context:
space:
mode:
authorAlexei Podtelezhnikov <apodtele@gmail.com>2021-12-11 22:42:46 -0500
committerAlexei Podtelezhnikov <apodtele@gmail.com>2021-12-11 22:42:46 -0500
commita8ef33e3aeb3a1435527dcc207e81133ca8de6c0 (patch)
tree8f6ac9b035672453436c6fa1d007dd522c177b91 /src/truetype/ttgload.c
parent6c831d658f879e542be0b789fbc38e4f45a33ace (diff)
downloadfreetype2-a8ef33e3aeb3a1435527dcc207e81133ca8de6c0.tar.gz
[truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable.
This simply shortcuts the glyph loading if FT_LOAD_ADVANCE_ONLY is specified by FT_Get_Advances and the `hdmx` data are located. Particularly, the classic v35 interpreter or "verified" ClearType fonts might see 100x speed up in retrieving the hdmx cache. * src/truetype/ttgload.c (TT_Load_Glyph): Insert the shortcut.
Diffstat (limited to 'src/truetype/ttgload.c')
-rw-r--r--src/truetype/ttgload.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index f18c6c2d2..81c2b1c81 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2945,6 +2945,15 @@
if ( error )
goto Exit;
+ /* done if we are only interested in the `hdmx` advance */
+ if ( load_flags & FT_LOAD_ADVANCE_ONLY &&
+ !( load_flags & FT_LOAD_VERTICAL_LAYOUT ) &&
+ loader.widthp )
+ {
+ glyph->metrics.horiAdvance = loader.widthp[glyph_index] * 64;
+ goto Done;
+ }
+
glyph->format = FT_GLYPH_FORMAT_OUTLINE;
glyph->num_subglyphs = 0;
glyph->outline.flags = 0;
@@ -3023,6 +3032,7 @@
glyph->outline.n_points,
glyph->outline.flags ));
+ Done:
tt_loader_done( &loader );
Exit: