Automatically initialize the fontconfig library

This commit is contained in:
Keith Packard 2002-02-19 08:33:23 +00:00
parent aae6f7d487
commit 6e9fc5ded4
3 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: $ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.2 2002/02/15 06:01:27 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -27,7 +27,7 @@
#include <stdio.h> #include <stdio.h>
#include "fcint.h" #include "fcint.h"
static FcConfig *fcConfig; FcConfig *_fcConfig;
FcConfig * FcConfig *
FcConfigCreate (void) FcConfigCreate (void)
@ -186,16 +186,19 @@ FcConfigSetCurrent (FcConfig *config)
if (!FcConfigBuildFonts (config)) if (!FcConfigBuildFonts (config))
return FcFalse; return FcFalse;
if (fcConfig) if (_fcConfig)
FcConfigDestroy (fcConfig); FcConfigDestroy (_fcConfig);
fcConfig = config; _fcConfig = config;
return FcTrue; return FcTrue;
} }
FcConfig * FcConfig *
FcConfigGetCurrent (void) FcConfigGetCurrent (void)
{ {
return fcConfig; if (!_fcConfig)
if (!FcInit ())
return 0;
return _fcConfig;
} }
FcBool FcBool

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: $ * $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.2 2002/02/15 06:01:28 keithp Exp $
* *
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -67,7 +67,7 @@ FcInitConfig (void)
{ {
FcConfig *config; FcConfig *config;
if (FcConfigGetCurrent ()) if (_fcConfig)
return FcTrue; return FcTrue;
config = FcConfigCreate (); config = FcConfigCreate ();

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.2 2002/02/15 06:01:28 keithp Exp $ * $XFree86: xc/lib/fontconfig/src/fcint.h,v 1.3 2002/02/18 22:29:28 keithp Exp $
* *
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
* *
@ -241,6 +241,8 @@ struct _FcConfig {
FcFontSet *fonts[FcSetApplication + 1]; FcFontSet *fonts[FcSetApplication + 1];
}; };
extern FcConfig *_fcConfig;
/* fcblanks.c */ /* fcblanks.c */
/* fccache.c */ /* fccache.c */