Explorar el Código

Fixed fontcap entry parsing: allows an empty path for GFONT_DRIVER type fonts.
Fixed the bug where R_font was not able to set GFONT_DRIVER fonts.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36389 15284696-431f-4ddb-bdfa-cd5b030d7da7

Huidae Cho hace 16 años
padre
commit
40b068a9e0
Se han modificado 2 ficheros con 11 adiciones y 6 borrados
  1. 2 2
      lib/driver/Font.c
  2. 9 4
      lib/driver/parse_ftcap.c

+ 2 - 2
lib/driver/Font.c

@@ -109,11 +109,11 @@ void COM_Set_font(const char *name)
     }
 
 
-    if (driver->Font_list && driver->Set_font) {
+    if (driver->Font_info && driver->Set_font) {
 	char **list = NULL;
 	int count = 0;
 
-	(*driver->Font_list)(&list, &count);
+	(*driver->Font_info)(&list, &count);
 
 	for (i = 0; i < count; i++) {
 	    struct GFONT_CAP cap;

+ 9 - 4
lib/driver/parse_ftcap.c

@@ -18,10 +18,15 @@ int parse_fontcap_entry(struct GFONT_CAP *e, const char *str)
     int type, index;
 
     if (sscanf(str, "%[^|]|%[^|]|%d|%[^|]|%d|%[^|]|",
-	       name, longname, &type, path, &index, encoding) != 6)
-	return 0;
-
-    if (!font_exists(path))
+	       name, longname, &type, path, &index, encoding) == 6) {
+        if (!font_exists(path))
+	    return 0;
+    }
+    /* GFONT_DRIVER type fonts do not have path. */
+    else if (sscanf(str, "%[^|]|%[^|]|%d||%d|%[^|]|",
+	       name, longname, &type, &index, encoding) == 5)
+	path[0] = '\0';
+    else
 	return 0;
 
     e->name = G_store(name);