[Commit] fontconfig/src fcfreetype.c,1.34,1.35

Keith Packard commit@keithp.com
Mon, 12 May 2003 13:49:01 -0700


Committed by: keithp

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

Modified Files:
	fcfreetype.c 
Log Message:
Use FcIsWidth to share code

Set FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH when scanning fonts to avoid
misclassifying some Han fonts as monospaced.


Index: fcfreetype.c
===================================================================
RCS file: /local/src/CVS/fontconfig/src/fcfreetype.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- fcfreetype.c	12 May 2003 09:11:10 -0000	1.34
+++ fcfreetype.c	12 May 2003 20:48:59 -0000	1.35
@@ -857,28 +857,13 @@
 	    case 9: width = FC_WIDTH_ULTRAEXPANDED; break;
 	    }
 	}
-	else if (MY_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 &&
-		 prop.type == BDF_PROPERTY_TYPE_ATOM)
+	if (width == -1 &&
+	    MY_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 &&
+	    prop.type == BDF_PROPERTY_TYPE_ATOM)
 	{
-	    static struct {
-		FcChar8	    *width_name;
-		int	    width;
-	    } FcSetWidths[] = {
-                { "Condensed",      FC_WIDTH_CONDENSED },
-                { "SemiCondensed",  FC_WIDTH_SEMICONDENSED },
-                { "Normal",         FC_WIDTH_NORMAL },
-   	    };
-	    int	i;
-
+	    width = FcIsWidth (prop.u.atom);
 	    if (FcDebug () & FC_DBG_SCANV)
-		printf ("\tsetwidth: %s\n", prop.u.atom);
-	    for (i = 0; i < sizeof (FcSetWidths) / sizeof (FcSetWidths[0]); i++)
-		if (!FcStrCmpIgnoreBlanksAndCase ((FcChar8 *) prop.u.atom,
-					 FcSetWidths[i].width_name))
-		{
-		    width = FcSetWidths[i].width;
-		    break;
-		}
+		printf ("\tsetwidth %s maps to %d\n", prop.u.atom, width);
 	}
     }
 
@@ -1760,7 +1745,7 @@
 		      FT_UInt glyph, FcBlanks *blanks,
 		      FT_Pos *advance)
 {
-    FT_Int	    load_flags = FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
+    FT_Int	    load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
     FT_GlyphSlot    slot;
     
     /*