[Commit] Xft xftfreetype.c,1.31,1.32

Keith Packard commit@keithp.com
Thu, 24 Apr 2003 09:15:00 -0700


Committed by: keithp

Update of /local/src/CVS/Xft
In directory home.keithp.com:/tmp/cvs-serv3099

Modified Files:
	xftfreetype.c 
Log Message:
Allow glyphs to range up to num_glyphs to fix PCF problems


Index: xftfreetype.c
===================================================================
RCS file: /local/src/CVS/Xft/xftfreetype.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- xftfreetype.c	17 Apr 2003 04:29:24 -0000	1.31
+++ xftfreetype.c	24 Apr 2003 16:14:58 -0000	1.32
@@ -638,6 +638,7 @@
     int			alloc_size;
     int			ascent, descent, height;
     int			i;
+    int			num_glyphs;
 
     if (!info)
 	return 0;
@@ -769,8 +770,13 @@
 	rehash_value = 0;
     }
     
+    /*
+     * Sometimes the glyphs are numbered 1..n, other times 0..n-1,
+     * accept either numbering scheme by making room in the table
+     */
+    num_glyphs = face->num_glyphs + 1;
     alloc_size = (sizeof (XftFontInt) + 
-		  face->num_glyphs * sizeof (XftGlyph *) +
+		  num_glyphs * sizeof (XftGlyph *) +
 		  hash_value * sizeof (XftUcsHash));
     font = malloc (alloc_size);
     
@@ -867,8 +873,8 @@
      * Per glyph information
      */
     font->glyphs = (XftGlyph **) (font + 1);
-    memset (font->glyphs, '\0', face->num_glyphs * sizeof (XftGlyph *));
-    font->num_glyphs = face->num_glyphs;
+    memset (font->glyphs, '\0', num_glyphs * sizeof (XftGlyph *));
+    font->num_glyphs = num_glyphs;
     /*
      * Unicode hash table information
      */