Allow runtime control of the number of X11 fonts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bill Medland (billmedland@xxxxxxxxxxxxxxxx)
Allow runtime increase in the maximum number of fonts processed.

Index: wine/graphics/x11drv/xfont.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v
retrieving revision 1.119
diff -u -r1.119 xfont.c
--- wine/graphics/x11drv/xfont.c	5 Sep 2003 23:15:45 -0000	1.119
+++ wine/graphics/x11drv/xfont.c	8 Sep 2003 23:08:40 -0000
@@ -29,7 +29,6 @@
 #include "ts_xlib.h"
 
 #include <ctype.h>
-#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -91,6 +90,7 @@
 static const char*	INIGlobalMetrics = "FontMetrics";
 static const char*	INIDefaultSerif = "DefaultSerif";
 static const char*	INIDefaultSansSerif = "DefaultSansSerif";
+static const char*      INIMaxFonts = "MaxX11Fonts";
 
 
 /* FIXME - are there any more Latin charsets ? */
@@ -2920,16 +2920,32 @@
 {
   char**    x_pattern;
   unsigned  x_checksum;
-  int       i, x_count, fd, buf_size;
+  int       i, x_count, x_max_fonts, fd, buf_size;
   char      *buffer;
   HKEY hkey;
 
+  buf_size = 128;
+  buffer = HeapAlloc( GetProcessHeap(), 0, buf_size );
+
+  x_max_fonts = MAX_FONTS;
+  buffer[0] = 0;
+  if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
+  {
+	DWORD type, count = buf_size;
+	RegQueryValueExA(hkey, INIMaxFonts, 0, &type, buffer, &count);
+	RegCloseKey(hkey);
+	if (buffer[0])
+	{
+	    int ival = atoi (buffer);
+	    if (ival > 0) x_max_fonts = ival;
+	}
+  }
 
-  x_pattern = TSXListFonts(gdi_display, "*", MAX_FONTS, &x_count );
+  x_pattern = TSXListFonts(gdi_display, "*", x_max_fonts, &x_count );
 
   TRACE("Font Mapper: initializing %i x11 fonts\n", x_count);
-  if (x_count == MAX_FONTS)
-      MESSAGE("There may be more fonts available - try increasing the value 
of MAX_FONTS\n");
+  if (x_count == x_max_fonts)
+      MESSAGE("There may be more fonts available - try increasing the value 
of %s in the [Fonts] section of the wine configuration file.\n", 
INIMaxFonts);
 
   for( i = x_checksum = 0; i < x_count; i++ )
   {
@@ -2942,8 +2958,6 @@
      if( j ) x_checksum ^= __genericCheckSum( x_pattern[i], j );
   }
   x_checksum |= X_PFONT_MAGIC;
-  buf_size = 128;
-  buffer = HeapAlloc( GetProcessHeap(), 0, buf_size );
 
   /* deal with systemwide font metrics cache */
 




[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux