freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] hdmx-advances fd3bae6 4/5: [truetype] Honor FT_LOAD_ADVANCE_


From: Werner Lemberg
Subject: [freetype2] hdmx-advances fd3bae6 4/5: [truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable.
Date: Fri, 10 Dec 2021 00:12:57 -0500 (EST)

branch: hdmx-advances
commit fd3bae6f8cce84133749e6380181e98930b54144
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [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.
---
 src/truetype/ttgload.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 6371883..91866b1 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2945,6 +2945,13 @@
     if ( error )
       goto Exit;
 
+    /* done if we are only interested in the `hdmx` advance */
+    if ( load_flags & FT_LOAD_ADVANCE_ONLY && 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 +3030,7 @@
                 glyph->outline.n_points,
                 glyph->outline.flags ));
 
+  Done:
     tt_loader_done( &loader );
 
   Exit:



reply via email to

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