]> git.wh0rd.org - fontconfig.git/commitdiff
Automatically initialize the fontconfig library
authorKeith Packard <keithp@keithp.com>
Tue, 19 Feb 2002 08:33:23 +0000 (08:33 +0000)
committerKeith Packard <keithp@keithp.com>
Tue, 19 Feb 2002 08:33:23 +0000 (08:33 +0000)
src/fccfg.c
src/fcinit.c
src/fcint.h

index 715f09170fdd57dd220214d8b92ed7990843c7c0..52d89ccab650f6c8f1f792f91d57bf23cd086e18 100644 (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.
  *
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include "fcint.h"
 
-static FcConfig    *fcConfig;
+FcConfig    *_fcConfig;
 
 FcConfig *
 FcConfigCreate (void)
@@ -186,16 +186,19 @@ FcConfigSetCurrent (FcConfig *config)
        if (!FcConfigBuildFonts (config))
            return FcFalse;
 
-    if (fcConfig)
-       FcConfigDestroy (fcConfig);
-    fcConfig = config;
+    if (_fcConfig)
+       FcConfigDestroy (_fcConfig);
+    _fcConfig = config;
     return FcTrue;
 }
 
 FcConfig *
 FcConfigGetCurrent (void)
 {
-    return fcConfig;
+    if (!_fcConfig)
+       if (!FcInit ())
+           return 0;
+    return _fcConfig;
 }
 
 FcBool
index b18d08a08af0446b37ab304049429efa4bb9f701..80324fbe71ae1c8194fb30ee677a51c5f11370a0 100644 (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.
  *
@@ -67,7 +67,7 @@ FcInitConfig (void)
 {
     FcConfig    *config;
     
-    if (FcConfigGetCurrent ())
+    if (_fcConfig)
        return FcTrue;
     
     config = FcConfigCreate ();
index dfdca441f3fafbd96536de1af1cd41c0bf834f22..1d0c07036dff13b2e5061ffb0ca3a008f126b46b 100644 (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.
  *
@@ -241,6 +241,8 @@ struct _FcConfig {
     FcFontSet  *fonts[FcSetApplication + 1];
 };
  
+extern FcConfig        *_fcConfig;
+
 /* fcblanks.c */
 
 /* fccache.c */