freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 90461c0: [afshaper] Delay creating `hb_set' objects u


From: Werner LEMBERG
Subject: [freetype2] master 90461c0: [afshaper] Delay creating `hb_set' objects until needed.
Date: Sat, 14 Oct 2017 05:43:46 -0400 (EDT)

branch: master
commit 90461c0137e5369fc0fdcaffc4abd640a9591cd3
Author: Behdad Esfahbod <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [afshaper] Delay creating `hb_set' objects until needed.
    
    In runs on Noto Naskh Arabic, this results in 89 sets created
    instead of 340 before.  Makes auto-hinter setup with HarfBuzz
    enabled 20% to 30% faster.
    
    * src/autofit/afshaper.c (af_shaper_get_coverage): Implement it.
---
 ChangeLog              | 10 ++++++++++
 src/autofit/afshaper.c | 31 +++++++++++++++----------------
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f8d322..4cc182a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-10-14  Behdad Esfahbod  <address@hidden>
+
+       [afshaper] Delay creating `hb_set' objects until needed.
+
+       In runs on Noto Naskh Arabic, this results in 89 sets created
+       instead of 340 before.  Makes auto-hinter setup with HarfBuzz
+       enabled 20% to 30% faster.
+
+       * src/autofit/afshaper.c (af_shaper_get_coverage): Implement it.
+
 2017-10-12  Ewald Hew  <address@hidden>
 
        [type1, cid] Add hinting engine switch.
diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c
index d259964..8ee9ba1 100644
--- a/src/autofit/afshaper.c
+++ b/src/autofit/afshaper.c
@@ -104,10 +104,10 @@
   {
     hb_face_t*  face;
 
-    hb_set_t*  gsub_lookups;  /* GSUB lookups for a given script */
-    hb_set_t*  gsub_glyphs;   /* glyphs covered by GSUB lookups  */
-    hb_set_t*  gpos_lookups;  /* GPOS lookups for a given script */
-    hb_set_t*  gpos_glyphs;   /* glyphs covered by GPOS lookups  */
+    hb_set_t*  gsub_lookups = NULL; /* GSUB lookups for a given script */
+    hb_set_t*  gsub_glyphs  = NULL; /* glyphs covered by GSUB lookups  */
+    hb_set_t*  gpos_lookups = NULL; /* GPOS lookups for a given script */
+    hb_set_t*  gpos_glyphs  = NULL; /* glyphs covered by GPOS lookups  */
 
     hb_script_t      script;
     const hb_tag_t*  coverage_tags;
@@ -127,11 +127,6 @@
 
     face = hb_font_get_face( globals->hb_font );
 
-    gsub_lookups = hb_set_create();
-    gsub_glyphs  = hb_set_create();
-    gpos_lookups = hb_set_create();
-    gpos_glyphs  = hb_set_create();
-
     coverage_tags = coverages[style_class->coverage];
     script        = scripts[style_class->script];
 
@@ -168,6 +163,7 @@
         script_tags[1] = HB_TAG_NONE;
     }
 
+    gsub_lookups = hb_set_create();
     hb_ot_layout_collect_lookups( face,
                                   HB_OT_TAG_GSUB,
                                   script_tags,
@@ -178,13 +174,6 @@
     if ( hb_set_is_empty( gsub_lookups ) )
       goto Exit; /* nothing to do */
 
-    hb_ot_layout_collect_lookups( face,
-                                  HB_OT_TAG_GPOS,
-                                  script_tags,
-                                  NULL,
-                                  coverage_tags,
-                                  gpos_lookups );
-
     FT_TRACE4(( "GSUB lookups (style `%s'):\n"
                 " ",
                 af_style_names[style_class->style] ));
@@ -193,6 +182,7 @@
     count = 0;
 #endif
 
+    gsub_glyphs = hb_set_create();
     for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); )
     {
 #ifdef FT_DEBUG_LEVEL_TRACE
@@ -220,10 +210,19 @@
                 " ",
                 af_style_names[style_class->style] ));
 
+    gpos_lookups = hb_set_create();
+    hb_ot_layout_collect_lookups( face,
+                                  HB_OT_TAG_GPOS,
+                                  script_tags,
+                                  NULL,
+                                  coverage_tags,
+                                  gpos_lookups );
+
 #ifdef FT_DEBUG_LEVEL_TRACE
     count = 0;
 #endif
 
+    gpos_glyphs = hb_set_create();
     for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); )
     {
 #ifdef FT_DEBUG_LEVEL_TRACE



reply via email to

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