[truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable.

This simply shortcuts the glyph loading if FT_LOAD_ADVANCE_ONLY
is specified and the `hdmx` data are located.

* src/truetype/ttgload.c (TT_Load_Glyph): Insert the shortcut.
This commit is contained in:
Alexei Podtelezhnikov 2021-12-10 22:29:21 -05:00
parent fa35370135
commit eaa10b993b
1 changed files with 10 additions and 0 deletions

View File

@ -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: