shithub: freetype+ttf2subf

Download patch

ref: 8b76eaf092f2b100f9a111c429d2c71c0a76fe91
parent: e03214e166c61b91ecb76e3b5fa5ee1c2a66ac56
author: Werner Lemberg <[email protected]>
date: Thu Oct 15 14:28:43 EDT 2015

* src/tools/ftfuzzer/ftfuzzer.cc: Handle fixed sizes (#46211).

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-15  Bungeman  <[email protected]>
+	    Werner Lemberg  <[email protected]>
+
+	* src/tools/ftfuzzer/ftfuzzer.cc: Handle fixed sizes (#46211).
+
 2015-10-15  Werner Lemberg  <[email protected]>
 
 	[base] Compute MD5 checksums only if explicitly requested.
--- a/src/tools/ftfuzzer/ftfuzzer.cc
+++ b/src/tools/ftfuzzer/ftfuzzer.cc
@@ -131,42 +131,59 @@
                                  &face ) )
           continue;
 
-        // set up 20pt at 72dpi as an arbitrary size
-        FT_Set_Char_Size( face, 20, 20, 72, 72 );
+        // loop over all bitmap stroke sizes
+        // and an arbitrary size for outlines
+        for ( long  fixed_sizes_index = 0;
+              fixed_sizes_index < face->num_fixed_sizes + 1;
+              fixed_sizes_index++ )
+        {
+          FT_Int32  flags = load_flags;
 
-        // test MM interface only for a face without a selected instance
-        if ( instance_index == 0 )
-          setIntermediateAxis( face );
+          if ( !fixed_sizes_index )
+          {
+            // set up 20pt at 72dpi as an arbitrary size
+            FT_Set_Char_Size( face, 20, 20, 72, 72 );
+            flags |= FT_LOAD_NO_BITMAP;
+          }
+          else
+          {
+            FT_Select_Size( face, fixed_sizes_index - 1 );
+            flags |= FT_LOAD_COLOR;
+          }
 
-        // loop over all glyphs
-        for ( unsigned int  glyph_index = 0;
-              glyph_index < (unsigned int)face->num_glyphs;
-              glyph_index++ )
-        {
-          if ( FT_Load_Glyph( face, glyph_index, load_flags ) )
-            continue;
+          // test MM interface only for a face without a selected instance
+          if ( instance_index == 0 )
+            setIntermediateAxis( face );
 
-          // Rendering is the most expensive and the least interesting part.
-          //
-          // if ( FT_Render_Glyph( face->glyph, render_mode) )
-          //   continue;
-          // FT_GlyphSlot_Embolden( face->glyph );
+          // loop over all glyphs
+          for ( unsigned int  glyph_index = 0;
+                glyph_index < (unsigned int)face->num_glyphs;
+                glyph_index++ )
+          {
+            if ( FT_Load_Glyph( face, glyph_index, flags ) )
+              continue;
 
+            // Rendering is the most expensive and the least interesting part.
+            //
+            // if ( FT_Render_Glyph( face->glyph, render_mode) )
+            //   continue;
+            // FT_GlyphSlot_Embolden( face->glyph );
+
 #if 0
-          FT_Glyph  glyph;
-          if ( !FT_Get_Glyph( face->glyph, &glyph ) )
-            FT_Done_Glyph( glyph );
+            FT_Glyph  glyph;
+            if ( !FT_Get_Glyph( face->glyph, &glyph ) )
+              FT_Done_Glyph( glyph );
 
-          FT_Outline*  outline = &face->glyph->outline;
-          FT_Matrix    rot30   = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 };
+            FT_Outline*  outline = &face->glyph->outline;
+            FT_Matrix    rot30   = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 };
 
-          FT_Outline_Transform( outline, &rot30 );
+            FT_Outline_Transform( outline, &rot30 );
 
-          FT_BBox  bbox;
-          FT_Outline_Get_BBox( outline, &bbox );
+            FT_BBox  bbox;
+            FT_Outline_Get_BBox( outline, &bbox );
 #endif
+          }
         }
-
         FT_Done_Face( face );
       }
     }