shithub: freetype+ttf2subf

Download patch

ref: 7774ac67ec562add4212930c82e402a7d7cdff8b
parent: 312d26a4915bcf7ca1e428f7bdf7ed631574dc13
author: Harsha <[email protected]>
date: Sat Dec 25 11:34:56 EST 2010

Apply Savannah patch #7422.

If we encouter a space in a string then the sbit buffer is NULL,
height and width are 0s.  So the check in ftc_snode_compare will
always pass for spaces (comparision with 255).  Here the comments
above the condition are proper but the implementation is not.  When
we create an snode I think it is the proper way to initialize the
width to 255 and then put a check for being equal to 255 in snode
compare function.

* src/cache/ftcsbits.c (FTC_SNode_New): Initialize sbit widths with
value 255.
(ftc_snode_compare): Fix condition.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-25  Harsha  <[email protected]>
+
+	Apply Savannah patch #7422.
+
+	If we encouter a space in a string then the sbit buffer is NULL,
+	height and width are 0s.  So the check in ftc_snode_compare will
+	always pass for spaces (comparision with 255).  Here the comments
+	above the condition are proper but the implementation is not.  When
+	we create an snode I think it is the proper way to initialize the
+	width to 255 and then put a check for being equal to 255 in snode
+	compare function.
+
+	* src/cache/ftcsbits.c (FTC_SNode_New): Initialize sbit widths with
+	value 255.
+	(ftc_snode_compare): Fix condition.
+
 2010-12-13  Werner Lemberg  <[email protected]>
 
 	Fix parameter handling of `FT_Set_Renderer'.
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -217,6 +217,7 @@
 
     FTC_SFamilyClass  clazz = FTC_CACHE__SFAMILY_CLASS( cache );
     FT_UInt           total;
+    FT_UInt           node_count;
 
 
     total = clazz->family_get_count( family, cache->manager );
@@ -239,6 +240,10 @@
       FTC_GNode_Init( FTC_GNODE( snode ), start, family );
 
       snode->count = count;
+      for ( node_count = 0; node_count < count; node_count++ )
+      {
+        snode->sbits[node_count].width = 255;
+      }
 
       error = ftc_snode_load( snode,
                               cache->manager,
@@ -368,7 +373,7 @@
        *
        */
 
-      if ( sbit->buffer == NULL && sbit->width != 255 )
+      if ( sbit->buffer == NULL && sbit->width == 255 )
       {
         FT_ULong  size;
         FT_Error  error;