2 * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.26 2002/08/19 19:32:04 keithp Exp $
4 * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
25 #ifndef _FONTCONFIG_H_
26 #define _FONTCONFIG_H_
30 typedef unsigned char FcChar8;
31 typedef unsigned short FcChar16;
32 typedef unsigned int FcChar32;
36 * Current Fontconfig version number
42 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
47 #define FC_FAMILY "family" /* String */
48 #define FC_STYLE "style" /* String */
49 #define FC_SLANT "slant" /* Int */
50 #define FC_WEIGHT "weight" /* Int */
51 #define FC_SIZE "size" /* Double */
52 #define FC_ASPECT "aspect" /* Double */
53 #define FC_PIXEL_SIZE "pixelsize" /* Double */
54 #define FC_SPACING "spacing" /* Int */
55 #define FC_FOUNDRY "foundry" /* String */
56 #define FC_ANTIALIAS "antialias" /* Bool (depends) */
57 #define FC_HINTING "hinting" /* Bool (true) */
58 #define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
59 #define FC_AUTOHINT "autohint" /* Bool (false) */
60 #define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
61 #define FC_FILE "file" /* String */
62 #define FC_INDEX "index" /* Int */
63 #define FC_FT_FACE "ftface" /* FT_Face */
64 #define FC_RASTERIZER "rasterizer" /* String */
65 #define FC_OUTLINE "outline" /* Bool */
66 #define FC_SCALABLE "scalable" /* Bool */
67 #define FC_SCALE "scale" /* double */
68 #define FC_DPI "dpi" /* double */
69 #define FC_RGBA "rgba" /* Int */
70 #define FC_MINSPACE "minspace" /* Bool use minimum line spacing */
71 #define FC_SOURCE "source" /* String (X11, freetype) */
72 #define FC_CHARSET "charset" /* CharSet */
73 #define FC_LANG "lang" /* String OS/2 CodePageRange */
75 #define FC_DIR_CACHE_FILE "fonts.cache"
76 #define FC_USER_CACHE_FILE ".fonts.cache"
78 /* Adjust outline rasterizer */
79 #define FC_CHAR_WIDTH "charwidth" /* Int */
80 #define FC_CHAR_HEIGHT "charheight"/* Int */
81 #define FC_MATRIX "matrix" /* FcMatrix */
83 #define FC_WEIGHT_LIGHT 0
84 #define FC_WEIGHT_MEDIUM 100
85 #define FC_WEIGHT_DEMIBOLD 180
86 #define FC_WEIGHT_BOLD 200
87 #define FC_WEIGHT_BLACK 210
89 #define FC_SLANT_ROMAN 0
90 #define FC_SLANT_ITALIC 100
91 #define FC_SLANT_OBLIQUE 110
93 #define FC_PROPORTIONAL 0
95 #define FC_CHARCELL 110
98 #define FC_RGBA_NONE 0
100 #define FC_RGBA_BGR 2
101 #define FC_RGBA_VRGB 3
102 #define FC_RGBA_VBGR 4
104 typedef enum _FcType {
116 typedef struct _FcMatrix {
117 double xx, xy, yx, yy;
120 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
121 (m)->xy = (m)->yx = 0)
124 * A data structure to represent the available glyphs in a font.
125 * This is represented as a sparse boolean btree.
128 typedef struct _FcCharSet FcCharSet;
130 typedef struct _FcObjectType {
135 typedef struct _FcConstant {
141 typedef enum _FcResult {
142 FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId
145 typedef struct _FcPattern FcPattern;
147 typedef struct _FcLangSet FcLangSet;
149 typedef struct _FcValue {
164 typedef struct _FcFontSet {
170 typedef struct _FcObjectSet {
173 const char **objects;
176 typedef enum _FcMatchKind {
177 FcMatchPattern, FcMatchFont
180 typedef enum _FcLangResult {
181 FcLangEqual, FcLangDifferentCountry, FcLangDifferentLang
184 typedef enum _FcSetName {
189 typedef struct _FcAtomic FcAtomic;
191 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
192 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
193 #define _FCFUNCPROTOEND }
195 #define _FCFUNCPROTOBEGIN
196 #define _FCFUNCPROTOEND
199 typedef enum { FcEndianBig, FcEndianLittle } FcEndian;
201 typedef struct _FcConfig FcConfig;
203 typedef struct _FcGlobalCache FcFileCache;
205 typedef struct _FcBlanks FcBlanks;
207 typedef struct _FcStrList FcStrList;
209 typedef struct _FcStrSet FcStrSet;
214 FcDirCacheValid (const FcChar8 *cache_file);
218 FcBlanksCreate (void);
221 FcBlanksDestroy (FcBlanks *b);
224 FcBlanksAdd (FcBlanks *b, FcChar32 ucs4);
227 FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
231 FcConfigFilename (const FcChar8 *url);
234 FcConfigCreate (void);
237 FcConfigDestroy (FcConfig *config);
240 FcConfigSetCurrent (FcConfig *config);
243 FcConfigGetCurrent (void);
246 FcConfigUptoDate (FcConfig *config);
249 FcConfigBuildFonts (FcConfig *config);
252 FcConfigGetFontDirs (FcConfig *config);
255 FcConfigGetConfigDirs (FcConfig *config);
258 FcConfigGetConfigFiles (FcConfig *config);
261 FcConfigGetCache (FcConfig *config);
264 FcConfigGetBlanks (FcConfig *config);
267 FcConfigGetRescanInverval (FcConfig *config);
270 FcConfigSetRescanInverval (FcConfig *config, int rescanInterval);
273 FcConfigGetFonts (FcConfig *config,
277 FcConfigAppFontAddFile (FcConfig *config,
278 const FcChar8 *file);
281 FcConfigAppFontAddDir (FcConfig *config,
285 FcConfigAppFontClear (FcConfig *config);
288 FcConfigSubstituteWithPat (FcConfig *config,
294 FcConfigSubstitute (FcConfig *config,
300 FcCharSetCreate (void);
303 FcCharSetDestroy (FcCharSet *fcs);
306 FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
309 FcCharSetCopy (FcCharSet *src);
312 FcCharSetEqual (const FcCharSet *a, const FcCharSet *b);
315 FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b);
318 FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
321 FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b);
324 FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4);
327 FcCharSetCount (const FcCharSet *a);
330 FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
333 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
336 FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b);
338 #define FC_CHARSET_MAP_SIZE (256/32)
339 #define FC_CHARSET_DONE ((FcChar32) -1)
342 FcCharSetFirstPage (const FcCharSet *a,
343 FcChar32 map[FC_CHARSET_MAP_SIZE],
347 FcCharSetNextPage (const FcCharSet *a,
348 FcChar32 map[FC_CHARSET_MAP_SIZE],
354 FcValuePrint (const FcValue v);
357 FcPatternPrint (const FcPattern *p);
360 FcFontSetPrint (const FcFontSet *s);
364 FcDefaultSubstitute (FcPattern *pattern);
368 FcFileScan (FcFontSet *set,
376 FcDirScan (FcFontSet *set,
384 FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
388 FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
393 FcFontSetCreate (void);
396 FcFontSetDestroy (FcFontSet *s);
399 FcFontSetAdd (FcFontSet *s, FcPattern *font);
403 FcInitLoadConfig (void);
406 FcInitLoadConfigAndFonts (void);
415 FcInitReinitialize (void);
418 FcInitBringUptoDate (void);
422 FcLangSetCreate (void);
425 FcLangSetDestroy (FcLangSet *ls);
428 FcLangSetCopy (const FcLangSet *ls);
431 FcLangSetAdd (FcLangSet *ls, const FcChar8 *lang);
434 FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang);
437 FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb);
440 FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb);
443 FcLangSetHash (const FcLangSet *ls);
447 FcObjectSetCreate (void);
450 FcObjectSetAdd (FcObjectSet *os, const char *object);
453 FcObjectSetDestroy (FcObjectSet *os);
456 FcObjectSetVaBuild (const char *first, va_list va);
459 FcObjectSetBuild (const char *first, ...);
462 FcFontSetList (FcConfig *config,
469 FcFontList (FcConfig *config,
476 FcAtomicCreate (const FcChar8 *file);
479 FcAtomicLock (FcAtomic *atomic);
482 FcAtomicNewFile (FcAtomic *atomic);
485 FcAtomicOrigFile (FcAtomic *atomic);
488 FcAtomicReplaceOrig (FcAtomic *atomic);
491 FcAtomicDeleteNew (FcAtomic *atomic);
494 FcAtomicUnlock (FcAtomic *atomic);
497 FcAtomicDestroy (FcAtomic *atomic);
501 FcFontSetMatch (FcConfig *config,
508 FcFontMatch (FcConfig *config,
513 FcFontRenderPrepare (FcConfig *config,
518 FcFontSetSort (FcConfig *config,
527 FcFontSort (FcConfig *config,
534 FcFontSetSortDestroy (FcFontSet *fs);
538 FcMatrixCopy (const FcMatrix *mat);
541 FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2);
544 FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b);
547 FcMatrixRotate (FcMatrix *m, double c, double s);
550 FcMatrixScale (FcMatrix *m, double sx, double sy);
553 FcMatrixShear (FcMatrix *m, double sh, double sv);
558 FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
561 FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
564 FcNameGetObjectType (const char *object);
567 FcNameRegisterConstants (const FcConstant *consts, int nconsts);
570 FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
573 FcNameGetConstant (FcChar8 *string);
576 FcNameConstant (FcChar8 *string, int *result);
579 FcNameParse (const FcChar8 *name);
582 FcNameUnparse (FcPattern *pat);
586 FcPatternCreate (void);
589 FcPatternDuplicate (FcPattern *p);
592 FcPatternReference (FcPattern *p);
595 FcValueDestroy (FcValue v);
598 FcValueEqual (FcValue va, FcValue vb);
601 FcValueSave (FcValue v);
604 FcPatternDestroy (FcPattern *p);
607 FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
610 FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os);
613 FcPatternHash (const FcPattern *p);
616 FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
619 FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append);
622 FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v);
625 FcPatternDel (FcPattern *p, const char *object);
628 FcPatternAddInteger (FcPattern *p, const char *object, int i);
631 FcPatternAddDouble (FcPattern *p, const char *object, double d);
634 FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
637 FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
640 FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
643 FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
646 FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls);
649 FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
652 FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
655 FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 ** s);
658 FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
661 FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
664 FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
667 FcPatternGetLangSet (FcPattern *p, const char *object, int n, FcLangSet **ls);
670 FcPatternVaBuild (FcPattern *orig, va_list va);
673 FcPatternBuild (FcPattern *orig, ...);
678 FcStrCopy (const FcChar8 *s);
681 FcStrCopyFilename (const FcChar8 *s);
683 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
686 FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
689 FcStrCmp (const FcChar8 *s1, const FcChar8 *s2);
692 FcUtf8ToUcs4 (FcChar8 *src_orig,
697 FcUtf8Len (FcChar8 *string,
702 #define FC_UTF8_MAX_LEN 6
705 FcUcs4ToUtf8 (FcChar32 ucs4,
706 FcChar8 dest[FC_UTF8_MAX_LEN]);
709 FcUtf16ToUcs4 (FcChar8 *src_orig,
712 int len); /* in bytes */
715 FcUtf16Len (FcChar8 *string,
717 int len, /* in bytes */
722 FcStrDirname (const FcChar8 *file);
725 FcStrBasename (const FcChar8 *file);
728 FcStrSetCreate (void);
731 FcStrSetMember (FcStrSet *set, const FcChar8 *s);
734 FcStrSetEqual (FcStrSet *sa, FcStrSet *sb);
737 FcStrSetAdd (FcStrSet *set, const FcChar8 *s);
740 FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s);
743 FcStrSetDel (FcStrSet *set, const FcChar8 *s);
746 FcStrSetDestroy (FcStrSet *set);
749 FcStrListCreate (FcStrSet *set);
752 FcStrListNext (FcStrList *list);
755 FcStrListDone (FcStrList *list);
759 FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
763 #endif /* _FONTCONFIG_H_ */