W3C home > Mailing lists > Public > www-amaya-dev@w3.org > November 2002

font checking problem

From: Atsuhiko Yamanaka <ymnk@jcraft.com>
Date: Wed, 27 Nov 2002 10:48:07 +0900
Message-Id: <200211270148.KAA10825@jcraft.com>
To: www-amaya-dev@w3.org

Hi,

Thanks to nice fontconfig system, I can display multi-byte (in my case, 
Japanese) characters on Gtk-Amaya, but Gtk-Amaya and xfs eat up many CPU time.

It seems that, whenever calculating character-width for each characters by
calling BoxCharacterWidth(in thotlib/dialogue/font.c),
XListFonts is called(in IsXLFDPatterneAFont of thotlib/dialogue/fontconfig.c)
and such frequent XListFonts calling has caused this problem.
How about calling IsXLFDPatterneAFont only one time for each XLFD?
I will post a patch.

Thanks,
--
ymnk

/*****************************************************************************/
diff -Naur Amaya/thotlib/dialogue/fontconfig.c Amaya-20021127/thotlib/dialogue/fontconfig.c
--- Amaya/thotlib/dialogue/fontconfig.c	2002-11-05 16:24:31.000000000 +0000
+++ Amaya-20021127/thotlib/dialogue/fontconfig.c	2002-11-27 01:35:13.000000000 +0000
@@ -358,6 +358,12 @@
 				     fontface = TtaGetMemory (sizeof (char) 
 							      * (strlen (&word[2]) + 1));
 				     strcpy (fontface, &word[2]);
+#ifndef _GL
+				     if(!IsXLFDPatterneAFont(fontface)){
+				       TtaFreeMemory (fontface);
+				       fontface=(char *)NULL;
+				     }
+#endif /*_GL*/
 				     fontsscript_tab[script]->family[font_face_index]->highlight[font_style]
 				       = fontface;
 				   }
@@ -475,14 +481,7 @@
       g_print ("\n%s",
 	       Fonttab[intscript]->family[font_face_index]->highlight[font_style]);
 #endif /*_PCLFONTDEBUG*/
-#ifndef _GL
-      if (IsXLFDPatterneAFont (Fonttab[intscript]->family[font_face_index]->highlight[font_style]))
-	return (Fonttab[intscript]->family[font_face_index]->highlight[font_style]);
-      else
-	return NULL;
-#else /*_GL*/
       return  (Fonttab[intscript]->family[font_face_index]->highlight[font_style]);
-#endif /*_GL*/
     }
   return NULL;
 }
Received on Tuesday, 26 November 2002 20:46:40 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:25:48 UTC