[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    [PATCH] mkfontscale problems
From:       James Richard Tyrer <tyrerj () acm ! org>
Date:       2005-06-26 19:13:42
Message-ID: 42BEFE66.5000206 () acm ! org
[Download RAW message or body]

I got errors like this:

[root@localhost Type1]# mkfontscale -e
/usr/X11R6/lib/X11/fonts/encodings -f 50
Unknown Type 1 weight "Compact"
Couldn't determine weight for aqct____.pfb
Unknown Type 1 weight "Poster"
Couldn't determine weight for bdps____.pfb
Unknown Type 1 weight "Poster"
Couldn't determine weight for bdpsc___.pfb

So I made changes to my system to remove the look up and replace it with 
  the attached patch that changes to lower case and removes blanks.

This has already been added to XFree86.

-- 
JRT

["mkfontscale1.patch" (text/plain)]

diff -Naur xc.old/programs/mkfontscale/mkfontscale.c xc/programs/mkfontscale/mkfontscale.c
--- xc.old/programs/mkfontscale/mkfontscale.c	2004-10-10 01:10:52.000000000 -0700
+++ xc/programs/mkfontscale/mkfontscale.c	2004-10-10 03:21:37.000000000 -0700
@@ -418,37 +418,31 @@
     return NULL;
 }
 
+static char weightL[500];
+
 static char*
 t1Weight(char *weight)
 {
-    if(!weight)
-        return NULL;
-    if(strcmp(weight, "Thin") == 0)
-        return "thin";
-    if(strcmp(weight, "Light") == 0)
-        return "light";
-    if(strcmp(weight, "Regular") == 0)
-        return "medium";
-    if(strcmp(weight, "Normal") == 0)
-        return "medium";
-    if(strcmp(weight, "Medium") == 0)
-        return "medium";
-    if(strcmp(weight, "Book") == 0)
-        return "medium";
-    if(strcmp(weight, "Roman") == 0) /* Some URW++ fonts do that! */
-        return "medium";
-    if(strcmp(weight, "Demi") == 0)
-        return "semibold";
-    if(strcmp(weight, "DemiBold") == 0)
-        return "semibold";
-    else if(strcmp(weight, "Bold") == 0)
-        return "bold";
-    else if(strcmp(weight, "Black") == 0)
-        return "black";
-    else {
-        fprintf(stderr, "Unknown Type 1 weight \"%s\"\n", weight);
-        return NULL;
+    unsigned int i = 0;
+    unsigned int n = strlen(weight);
+    unsigned int j; 
+    unsigned char ch;
+    unsigned char space = ' '; 
+
+    if(n >= 499) return NULL;
+    for( j = 0; j < n; j++ )
+    {
+        ch = (unsigned char) tolower(weight[j]);
+    	if ( ch != space)
+	{
+            weightL[i] = ch ;
+	    i++ ;
+	}    
     }
+    weightL[i] = '\0';
+    if(!weightL)
+        return NULL;
+    else return weightL;
 }
 
 static int


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic