Imported Upstream version 2.13.0
[platform/upstream/fontconfig.git] / src / fcint.h
index ac911ad..5de311f 100644 (file)
@@ -70,6 +70,12 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
 #  define FC_DIR_SEPARATOR_S       "/"
 #endif
 
+#ifdef PATH_MAX
+#define FC_PATH_MAX    PATH_MAX
+#else
+#define FC_PATH_MAX    128
+#endif
+
 #if __GNUC__ >= 4
 #define FC_UNUSED      __attribute__((unused))
 #else
@@ -95,7 +101,6 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
 
 #define FC_MIN(a,b) ((a) < (b) ? (a) : (b))
 #define FC_MAX(a,b) ((a) > (b) ? (a) : (b))
-#define FC_ABS(a)   ((a) < 0 ? -(a) : (a))
 
 /* slim_internal.h */
 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun)
@@ -108,13 +113,18 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
 #define FcPrivate
 #endif
 
-FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
+/* NLS */
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(x)           (dgettext(GETTEXT_PACKAGE, x))
+#else
+#define dgettext(d, s) (s)
+#define _(x)           (x)
+#endif
+
+#define N_(x)  x
 
-typedef enum _FcValueBinding {
-    FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
-    /* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
-    FcValueBindingEnd = INT_MAX
-} FcValueBinding;
+FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
 
 #define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
 #define FcFree(s) (free ((FcChar8 *) (s)))
@@ -304,6 +314,16 @@ typedef struct _FcEdit {
     FcValueBinding  binding;
 } FcEdit;
 
+typedef void (* FcDestroyFunc) (void *data);
+
+typedef struct _FcPtrList      FcPtrList;
+/* need to sync with FcConfigFileInfoIter at fontconfig.h */
+typedef struct _FcPtrListIter {
+    void *dummy1;
+    void *dummy2;
+    void *dummy3;
+} FcPtrListIter;
+
 typedef enum _FcRuleType {
     FcRuleUnknown, FcRuleTest, FcRuleEdit
 } FcRuleType;
@@ -317,10 +337,14 @@ typedef struct _FcRule {
     } u;
 } FcRule;
 
-typedef struct _FcSubst {
-    struct _FcSubst    *next;
-    FcRule             *rule;
-} FcSubst;
+typedef struct _FcRuleSet {
+    FcRef      ref;
+    FcChar8    *name;
+    FcChar8    *description;
+    FcChar8    *domain;
+    FcBool     enabled;
+    FcPtrList  *subst[FcMatchKindEnd];
+} FcRuleSet;
 
 typedef struct _FcCharLeaf {
     FcChar32   map[256/32];
@@ -368,6 +392,13 @@ typedef struct _FcStrBuf {
     FcChar8 buf_static[16 * sizeof (void *)];
 } FcStrBuf;
 
+typedef struct _FcHashTable    FcHashTable;
+
+typedef FcChar32 (* FcHashFunc)           (const void *data);
+typedef int     (* FcCompareFunc) (const void *v1, const void *v2);
+typedef FcBool  (* FcCopyFunc)    (const void *src, void **dest);
+
+
 struct _FcCache {
     unsigned int magic;              /* FC_CACHE_MAGIC_MMAP or FC_CACHE_ALLOC */
     int                version;            /* FC_CACHE_VERSION_NUMBER */
@@ -471,12 +502,6 @@ struct _FcAtomic {
     FcChar8    *tmp;           /* tmpfile name (used for locking) */
 };
 
-struct _FcBlanks {
-    int                nblank;
-    int                sblank;
-    FcChar32   *blanks;
-};
-
 struct _FcConfig {
     /*
      * File names loaded from the configuration -- saved here as the
@@ -485,11 +510,6 @@ struct _FcConfig {
      */
     FcStrSet   *configDirs;        /* directories to scan for fonts */
     /*
-     * Set of allowed blank chars -- used to
-     * trim fonts of bogus glyphs
-     */
-    FcBlanks   *blanks;
-    /*
      * List of directories containing fonts,
      * built by recursively scanning the set
      * of configured directories
@@ -508,10 +528,12 @@ struct _FcConfig {
      * Substitution instructions for patterns and fonts;
      * maxObjects is used to allocate appropriate intermediate storage
      * while performing a whole set of substitutions
+     *
+     * 0.. substitutions for patterns
+     * 1.. substitutions for fonts
+     * 2.. substitutions for scanned fonts
      */
-    FcSubst    *substPattern;      /* substitutions for patterns */
-    FcSubst    *substFont;         /* substitutions for fonts */
-    FcSubst    *substScan;         /* substitutions for scanned fonts */
+    FcPtrList  *subst[FcMatchKindEnd];
     int                maxObjects;         /* maximum number of tests in all substs */
     /*
      * List of patterns used to control font file selection
@@ -541,6 +563,10 @@ struct _FcConfig {
     FcExprPage  *expr_pool;        /* pool of FcExpr's */
 
     FcChar8     *sysRoot;          /* override the system root directory */
+    FcStrSet   *availConfigFiles;  /* config files available */
+    FcPtrList  *rulesetList;       /* List of rulesets being installed */
+    FcHashTable *uuid_table;       /* UUID table for cachedirs */
+    FcHashTable *alias_table;      /* alias table for cachedirs */
 };
 
 typedef struct _FcFileTime {
@@ -568,8 +594,6 @@ struct _FcValuePromotionBuffer {
   } u;
 };
 
-/* fcblanks.c */
-
 /* fccache.c */
 
 FcPrivate FcCache *
@@ -635,10 +659,6 @@ FcConfigAddFontDir (FcConfig           *config,
                    const FcChar8   *d);
 
 FcPrivate FcBool
-FcConfigAddDir (FcConfig       *config,
-               const FcChar8   *d);
-
-FcPrivate FcBool
 FcConfigAddCacheDir (FcConfig      *config,
                     const FcChar8  *d);
 
@@ -690,6 +710,29 @@ FcPrivate FcBool
 FcConfigAddCache (FcConfig *config, FcCache *cache,
                  FcSetName set, FcStrSet *dirSet);
 
+FcPrivate FcRuleSet *
+FcRuleSetCreate (const FcChar8 *name);
+
+FcPrivate void
+FcRuleSetDestroy (FcRuleSet *rs);
+
+FcPrivate void
+FcRuleSetReference (FcRuleSet *rs);
+
+FcPrivate void
+FcRuleSetEnable (FcRuleSet     *rs,
+                FcBool         flag);
+
+FcPrivate void
+FcRuleSetAddDescription (FcRuleSet     *rs,
+                        const FcChar8  *domain,
+                        const FcChar8  *description);
+
+FcPrivate int
+FcRuleSetAdd (FcRuleSet                *rs,
+             FcRule            *rule,
+             FcMatchKind       kind);
+
 /* fcserialize.c */
 FcPrivate intptr_t
 FcAlignSize (intptr_t size);
@@ -775,6 +818,11 @@ FcRandom (void);
 FcPrivate FcBool
 FcMakeDirectory (const FcChar8 *dir);
 
+FcPrivate ssize_t
+FcReadLink (const FcChar8 *pathname,
+           FcChar8       *buf,
+           size_t         bufsiz);
+
 /* fcdbg.c */
 
 FcPrivate void
@@ -805,7 +853,7 @@ FcPrivate void
 FcEditPrint (const FcEdit *edit);
 
 FcPrivate void
-FcSubstPrint (const FcSubst *subst);
+FcRulePrint (const FcRule *rule);
 
 FcPrivate void
 FcCharSetPrint (const FcCharSet *c);
@@ -841,14 +889,12 @@ FcFileIsFile (const FcChar8 *file);
 FcPrivate FcBool
 FcFileScanConfig (FcFontSet    *set,
                  FcStrSet      *dirs,
-                 FcBlanks      *blanks,
                  const FcChar8 *file,
                  FcConfig      *config);
 
 FcPrivate FcBool
 FcDirScanConfig (FcFontSet     *set,
                 FcStrSet       *dirs,
-                FcBlanks       *blanks,
                 const FcChar8  *dir,
                 FcBool         force,
                 FcConfig       *config);
@@ -868,6 +914,42 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
 FcPrivate FcFontSet *
 FcFontSetDeserialize (const FcFontSet *set);
 
+/* fcplist.c */
+FcPrivate FcPtrList *
+FcPtrListCreate (FcDestroyFunc func);
+
+FcPrivate void
+FcPtrListDestroy (FcPtrList *list);
+
+FcPrivate void
+FcPtrListIterInit (const FcPtrList     *list,
+                  FcPtrListIter        *iter);
+
+FcPrivate void
+FcPtrListIterInitAtLast (FcPtrList     *list,
+                        FcPtrListIter  *iter);
+
+FcPrivate FcBool
+FcPtrListIterNext (const FcPtrList     *list,
+                  FcPtrListIter        *iter);
+
+FcPrivate FcBool
+FcPtrListIterIsValid (const FcPtrList          *list,
+                     const FcPtrListIter       *iter);
+
+FcPrivate void *
+FcPtrListIterGetValue (const FcPtrList         *list,
+                      const FcPtrListIter      *iter);
+
+FcPrivate FcBool
+FcPtrListIterAdd (FcPtrList    *list,
+                 FcPtrListIter *iter,
+               void            *data);
+
+FcPrivate FcBool
+FcPtrListIterRemove (FcPtrList         *list,
+                    FcPtrListIter      *iter);
+
 /* fcinit.c */
 FcPrivate FcConfig *
 FcInitLoadOwnConfig (FcConfig *config);
@@ -908,6 +990,15 @@ FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
 FcPrivate FcChar8 *
 FcNameUnparseEscaped (FcPattern *pat, FcBool escape);
 
+FcPrivate FcBool
+FcConfigParseOnly (FcConfig            *config,
+                  const FcChar8        *name,
+                  FcBool               complain);
+
+FcPrivate FcChar8 *
+FcConfigRealFilename (FcConfig         *config,
+                     const FcChar8     *url);
+
 /* fclist.c */
 
 FcPrivate FcBool
@@ -994,6 +1085,9 @@ FcPrivate FcBool
 FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
 
 FcPrivate FcResult
+FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b);
+
+FcPrivate FcResult
 FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
 
 FcPrivate FcBool
@@ -1209,4 +1303,42 @@ FcObjectLookupOtherTypeById (FcObject id);
 FcPrivate const FcObjectType *
 FcObjectLookupOtherTypeByName (const char *str);
 
+/* fchash.c */
+FcPrivate FcBool
+FcHashStrCopy (const void  *src,
+              void       **dest);
+
+FcPrivate FcBool
+FcHashUuidCopy (const void  *src,
+               void       **dest);
+
+FcPrivate void
+FcHashUuidFree (void *data);
+
+FcPrivate FcHashTable *
+FcHashTableCreate (FcHashFunc    hash_func,
+                  FcCompareFunc compare_func,
+                  FcCopyFunc    key_copy_func,
+                  FcCopyFunc    value_copy_func,
+                  FcDestroyFunc key_destroy_func,
+                  FcDestroyFunc value_destroy_func);
+
+FcPrivate void
+FcHashTableDestroy (FcHashTable *table);
+
+FcPrivate FcBool
+FcHashTableFind (FcHashTable  *table,
+                const void   *key,
+                void        **value);
+
+FcPrivate FcBool
+FcHashTableAdd (FcHashTable *table,
+               void        *key,
+               void        *value);
+
+FcPrivate FcBool
+FcHashTableReplace (FcHashTable *table,
+                   void        *key,
+                   void        *value);
+
 #endif /* _FC_INT_H_ */