diff options
Diffstat (limited to 'difs/initfonts.c')
-rw-r--r-- | difs/initfonts.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/difs/initfonts.c b/difs/initfonts.c index ea6c95a..9ed7675 100644 --- a/difs/initfonts.c +++ b/difs/initfonts.c @@ -47,20 +47,81 @@ in this Software without prior written authorization from The Open Group. * %W% %E% * */ +/* $XFree86: xc/programs/xfs/difs/initfonts.c,v 1.7 2001/12/14 20:01:34 dawes Exp $ */ #include "font.h" +#include "difs.h" +#ifdef FONTCACHE +#include "misc.h" +#include <X11/extensions/fontcacheP.h> + +#define CACHE_HI_MARK (2048 * 1024) +#define CACHE_LOW_MARK (((2048 * 1024) / 4) * 3) +#define CACHE_BALANCE 70 +#endif FontPatternCachePtr fontPatternCache; +#ifdef FONTCACHE +FontCacheSettings cacheSettings = { -1, -1, -1 }; +#endif void -InitFonts() +InitFonts(void) { +#ifdef FONTCACHE + long himark, lowmark; + long balance; + FontCacheSettings cs; +#endif + if (fontPatternCache) FreeFontPatternCache(fontPatternCache); fontPatternCache = MakeFontPatternCache(); ResetFontPrivateIndex(); +#ifdef FONTCACHE + /* check cache control parameters */ + if (cacheSettings.himark == -1) { + himark = CACHE_HI_MARK; + if (cacheSettings.lowmark == -1) { + lowmark = CACHE_LOW_MARK; + } else { + lowmark = cacheSettings.lowmark; + } + } else { + himark = cacheSettings.himark; + if (cacheSettings.lowmark == -1) { + lowmark = (himark / 4) * 3; + } else { + lowmark = cacheSettings.lowmark; + } + } + if (cacheSettings.balance == -1) { + balance = CACHE_BALANCE; + } else { + balance = cacheSettings.balance; + } + + if (himark <= 0 || lowmark <= 0) { + FatalError("illegal cache parameter setting\n"); + } + if (himark <= lowmark) { + FatalError("illegal cache parameter setting\n"); + } + if (!(10 <= balance && balance <= 90)) { + FatalError("illegal cache parameter setting\n"); + } + + /* set cache control parameters */ + cs.himark = himark; + cs.lowmark = lowmark; + cs.balance = balance; + if (FontCacheChangeSettings(&cs) == 0) { + FatalError("couldn't init renderer font cache\n"); + } +#endif + #ifdef FONT_PCF FontFileRegisterFpeFunctions(); #ifdef LOWMEMFTPT |