2 * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.30 2002/09/26 00:17:27 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))
45 * Current font cache file format version
46 * This is appended to the cache files so that multiple
47 * versions of the library will peacefully coexist
49 * Change this value whenever the disk format for the cache file
50 * changes in any non-compatible way. Try to avoid such changes as
51 * it means multiple copies of the font information.
54 #define FC_CACHE_VERSION "1"
59 #define FC_FAMILY "family" /* String */
60 #define FC_STYLE "style" /* String */
61 #define FC_SLANT "slant" /* Int */
62 #define FC_WEIGHT "weight" /* Int */
63 #define FC_SIZE "size" /* Double */
64 #define FC_ASPECT "aspect" /* Double */
65 #define FC_PIXEL_SIZE "pixelsize" /* Double */
66 #define FC_SPACING "spacing" /* Int */
67 #define FC_FOUNDRY "foundry" /* String */
68 #define FC_ANTIALIAS "antialias" /* Bool (depends) */
69 #define FC_HINTING "hinting" /* Bool (true) */
70 #define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
71 #define FC_AUTOHINT "autohint" /* Bool (false) */
72 #define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
73 #define FC_FILE "file" /* String */
74 #define FC_INDEX "index" /* Int */
75 #define FC_FT_FACE "ftface" /* FT_Face */
76 #define FC_RASTERIZER "rasterizer" /* String */
77 #define FC_OUTLINE "outline" /* Bool */
78 #define FC_SCALABLE "scalable" /* Bool */
79 #define FC_SCALE "scale" /* double */
80 #define FC_DPI "dpi" /* double */
81 #define FC_RGBA "rgba" /* Int */
82 #define FC_MINSPACE "minspace" /* Bool use minimum line spacing */
83 #define FC_SOURCE "source" /* String (X11, freetype) */
84 #define FC_CHARSET "charset" /* CharSet */
85 #define FC_LANG "lang" /* String RFC 3066 langs */
86 #define FC_FONTVERSION "fontversion" /* Int from 'head' table */
88 #define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION
89 #define FC_USER_CACHE_FILE ".fonts.cache-"FC_CACHE_VERSION
91 /* Adjust outline rasterizer */
92 #define FC_CHAR_WIDTH "charwidth" /* Int */
93 #define FC_CHAR_HEIGHT "charheight"/* Int */
94 #define FC_MATRIX "matrix" /* FcMatrix */
96 #define FC_WEIGHT_LIGHT 0
97 #define FC_WEIGHT_MEDIUM 100
98 #define FC_WEIGHT_DEMIBOLD 180
99 #define FC_WEIGHT_BOLD 200
100 #define FC_WEIGHT_BLACK 210
102 #define FC_SLANT_ROMAN 0
103 #define FC_SLANT_ITALIC 100
104 #define FC_SLANT_OBLIQUE 110
106 #define FC_PROPORTIONAL 0
108 #define FC_CHARCELL 110
110 /* sub-pixel order */
111 #define FC_RGBA_UNKNOWN 0
112 #define FC_RGBA_RGB 1
113 #define FC_RGBA_BGR 2
114 #define FC_RGBA_VRGB 3
115 #define FC_RGBA_VBGR 4
116 #define FC_RGBA_NONE 5
118 typedef enum _FcType
{
130 typedef struct _FcMatrix
{
131 double xx
, xy
, yx
, yy
;
134 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
135 (m)->xy = (m)->yx = 0)
138 * A data structure to represent the available glyphs in a font.
139 * This is represented as a sparse boolean btree.
142 typedef struct _FcCharSet FcCharSet
;
144 typedef struct _FcObjectType
{
149 typedef struct _FcConstant
{
155 typedef enum _FcResult
{
156 FcResultMatch
, FcResultNoMatch
, FcResultTypeMismatch
, FcResultNoId
159 typedef struct _FcPattern FcPattern
;
161 typedef struct _FcLangSet FcLangSet
;
163 typedef struct _FcValue
{
178 typedef struct _FcFontSet
{
184 typedef struct _FcObjectSet
{
187 const char **objects
;
190 typedef enum _FcMatchKind
{
191 FcMatchPattern
, FcMatchFont
194 typedef enum _FcLangResult
{
195 FcLangEqual
, FcLangDifferentCountry
, FcLangDifferentLang
198 typedef enum _FcSetName
{
203 typedef struct _FcAtomic FcAtomic
;
205 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
206 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
207 #define _FCFUNCPROTOEND }
209 #define _FCFUNCPROTOBEGIN
210 #define _FCFUNCPROTOEND
213 typedef enum { FcEndianBig
, FcEndianLittle
} FcEndian
;
215 typedef struct _FcConfig FcConfig
;
217 typedef struct _FcGlobalCache FcFileCache
;
219 typedef struct _FcBlanks FcBlanks
;
221 typedef struct _FcStrList FcStrList
;
223 typedef struct _FcStrSet FcStrSet
;
228 FcDirCacheValid (const FcChar8
*cache_file
);
232 FcBlanksCreate (void);
235 FcBlanksDestroy (FcBlanks
*b
);
238 FcBlanksAdd (FcBlanks
*b
, FcChar32 ucs4
);
241 FcBlanksIsMember (FcBlanks
*b
, FcChar32 ucs4
);
245 FcConfigFilename (const FcChar8
*url
);
248 FcConfigCreate (void);
251 FcConfigDestroy (FcConfig
*config
);
254 FcConfigSetCurrent (FcConfig
*config
);
257 FcConfigGetCurrent (void);
260 FcConfigUptoDate (FcConfig
*config
);
263 FcConfigBuildFonts (FcConfig
*config
);
266 FcConfigGetFontDirs (FcConfig
*config
);
269 FcConfigGetConfigDirs (FcConfig
*config
);
272 FcConfigGetConfigFiles (FcConfig
*config
);
275 FcConfigGetCache (FcConfig
*config
);
278 FcConfigGetBlanks (FcConfig
*config
);
281 FcConfigGetRescanInverval (FcConfig
*config
);
284 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
);
287 FcConfigGetFonts (FcConfig
*config
,
291 FcConfigAppFontAddFile (FcConfig
*config
,
292 const FcChar8
*file
);
295 FcConfigAppFontAddDir (FcConfig
*config
,
299 FcConfigAppFontClear (FcConfig
*config
);
302 FcConfigSubstituteWithPat (FcConfig
*config
,
308 FcConfigSubstitute (FcConfig
*config
,
314 FcCharSetCreate (void);
317 FcCharSetDestroy (FcCharSet
*fcs
);
320 FcCharSetAddChar (FcCharSet
*fcs
, FcChar32 ucs4
);
323 FcCharSetCopy (FcCharSet
*src
);
326 FcCharSetEqual (const FcCharSet
*a
, const FcCharSet
*b
);
329 FcCharSetIntersect (const FcCharSet
*a
, const FcCharSet
*b
);
332 FcCharSetUnion (const FcCharSet
*a
, const FcCharSet
*b
);
335 FcCharSetSubtract (const FcCharSet
*a
, const FcCharSet
*b
);
338 FcCharSetHasChar (const FcCharSet
*fcs
, FcChar32 ucs4
);
341 FcCharSetCount (const FcCharSet
*a
);
344 FcCharSetIntersectCount (const FcCharSet
*a
, const FcCharSet
*b
);
347 FcCharSetSubtractCount (const FcCharSet
*a
, const FcCharSet
*b
);
350 FcCharSetIsSubset (const FcCharSet
*a
, const FcCharSet
*b
);
352 #define FC_CHARSET_MAP_SIZE (256/32)
353 #define FC_CHARSET_DONE ((FcChar32) -1)
356 FcCharSetFirstPage (const FcCharSet
*a
,
357 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
361 FcCharSetNextPage (const FcCharSet
*a
,
362 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
368 FcValuePrint (const FcValue v
);
371 FcPatternPrint (const FcPattern
*p
);
374 FcFontSetPrint (const FcFontSet
*s
);
378 FcDefaultSubstitute (FcPattern
*pattern
);
382 FcFileScan (FcFontSet
*set
,
390 FcDirScan (FcFontSet
*set
,
398 FcDirSave (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
);
402 FcFreeTypeQuery (const FcChar8
*file
, int id
, FcBlanks
*blanks
, int *count
);
407 FcFontSetCreate (void);
410 FcFontSetDestroy (FcFontSet
*s
);
413 FcFontSetAdd (FcFontSet
*s
, FcPattern
*font
);
417 FcInitLoadConfig (void);
420 FcInitLoadConfigAndFonts (void);
429 FcInitReinitialize (void);
432 FcInitBringUptoDate (void);
436 FcLangSetCreate (void);
439 FcLangSetDestroy (FcLangSet
*ls
);
442 FcLangSetCopy (const FcLangSet
*ls
);
445 FcLangSetAdd (FcLangSet
*ls
, const FcChar8
*lang
);
448 FcLangSetHasLang (const FcLangSet
*ls
, const FcChar8
*lang
);
451 FcLangSetCompare (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
454 FcLangSetEqual (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
457 FcLangSetHash (const FcLangSet
*ls
);
461 FcObjectSetCreate (void);
464 FcObjectSetAdd (FcObjectSet
*os
, const char *object
);
467 FcObjectSetDestroy (FcObjectSet
*os
);
470 FcObjectSetVaBuild (const char *first
, va_list va
);
473 FcObjectSetBuild (const char *first
, ...);
476 FcFontSetList (FcConfig
*config
,
483 FcFontList (FcConfig
*config
,
490 FcAtomicCreate (const FcChar8
*file
);
493 FcAtomicLock (FcAtomic
*atomic
);
496 FcAtomicNewFile (FcAtomic
*atomic
);
499 FcAtomicOrigFile (FcAtomic
*atomic
);
502 FcAtomicReplaceOrig (FcAtomic
*atomic
);
505 FcAtomicDeleteNew (FcAtomic
*atomic
);
508 FcAtomicUnlock (FcAtomic
*atomic
);
511 FcAtomicDestroy (FcAtomic
*atomic
);
515 FcFontSetMatch (FcConfig
*config
,
522 FcFontMatch (FcConfig
*config
,
527 FcFontRenderPrepare (FcConfig
*config
,
532 FcFontSetSort (FcConfig
*config
,
541 FcFontSort (FcConfig
*config
,
548 FcFontSetSortDestroy (FcFontSet
*fs
);
552 FcMatrixCopy (const FcMatrix
*mat
);
555 FcMatrixEqual (const FcMatrix
*mat1
, const FcMatrix
*mat2
);
558 FcMatrixMultiply (FcMatrix
*result
, const FcMatrix
*a
, const FcMatrix
*b
);
561 FcMatrixRotate (FcMatrix
*m
, double c
, double s
);
564 FcMatrixScale (FcMatrix
*m
, double sx
, double sy
);
567 FcMatrixShear (FcMatrix
*m
, double sh
, double sv
);
572 FcNameRegisterObjectTypes (const FcObjectType
*types
, int ntype
);
575 FcNameUnregisterObjectTypes (const FcObjectType
*types
, int ntype
);
578 FcNameGetObjectType (const char *object
);
581 FcNameRegisterConstants (const FcConstant
*consts
, int nconsts
);
584 FcNameUnregisterConstants (const FcConstant
*consts
, int nconsts
);
587 FcNameGetConstant (FcChar8
*string
);
590 FcNameConstant (FcChar8
*string
, int *result
);
593 FcNameParse (const FcChar8
*name
);
596 FcNameUnparse (FcPattern
*pat
);
600 FcPatternCreate (void);
603 FcPatternDuplicate (const FcPattern
*p
);
606 FcPatternReference (FcPattern
*p
);
609 FcValueDestroy (FcValue v
);
612 FcValueEqual (FcValue va
, FcValue vb
);
615 FcValueSave (FcValue v
);
618 FcPatternDestroy (FcPattern
*p
);
621 FcPatternEqual (const FcPattern
*pa
, const FcPattern
*pb
);
624 FcPatternEqualSubset (const FcPattern
*pa
, const FcPattern
*pb
, const FcObjectSet
*os
);
627 FcPatternHash (const FcPattern
*p
);
630 FcPatternAdd (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
633 FcPatternAddWeak (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
636 FcPatternGet (const FcPattern
*p
, const char *object
, int id
, FcValue
*v
);
639 FcPatternDel (FcPattern
*p
, const char *object
);
642 FcPatternAddInteger (FcPattern
*p
, const char *object
, int i
);
645 FcPatternAddDouble (FcPattern
*p
, const char *object
, double d
);
648 FcPatternAddString (FcPattern
*p
, const char *object
, const FcChar8
*s
);
651 FcPatternAddMatrix (FcPattern
*p
, const char *object
, const FcMatrix
*s
);
654 FcPatternAddCharSet (FcPattern
*p
, const char *object
, const FcCharSet
*c
);
657 FcPatternAddBool (FcPattern
*p
, const char *object
, FcBool b
);
660 FcPatternAddLangSet (FcPattern
*p
, const char *object
, const FcLangSet
*ls
);
663 FcPatternGetInteger (const FcPattern
*p
, const char *object
, int n
, int *i
);
666 FcPatternGetDouble (const FcPattern
*p
, const char *object
, int n
, double *d
);
669 FcPatternGetString (const FcPattern
*p
, const char *object
, int n
, FcChar8
** s
);
672 FcPatternGetMatrix (const FcPattern
*p
, const char *object
, int n
, FcMatrix
**s
);
675 FcPatternGetCharSet (const FcPattern
*p
, const char *object
, int n
, FcCharSet
**c
);
678 FcPatternGetBool (const FcPattern
*p
, const char *object
, int n
, FcBool
*b
);
681 FcPatternGetLangSet (const FcPattern
*p
, const char *object
, int n
, FcLangSet
**ls
);
684 FcPatternVaBuild (FcPattern
*orig
, va_list va
);
687 FcPatternBuild (FcPattern
*orig
, ...);
692 FcStrCopy (const FcChar8
*s
);
695 FcStrCopyFilename (const FcChar8
*s
);
697 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
700 FcStrCmpIgnoreCase (const FcChar8
*s1
, const FcChar8
*s2
);
703 FcStrCmp (const FcChar8
*s1
, const FcChar8
*s2
);
706 FcUtf8ToUcs4 (const FcChar8
*src_orig
,
711 FcUtf8Len (const FcChar8
*string
,
716 #define FC_UTF8_MAX_LEN 6
719 FcUcs4ToUtf8 (FcChar32 ucs4
,
720 FcChar8 dest
[FC_UTF8_MAX_LEN
]);
723 FcUtf16ToUcs4 (const FcChar8
*src_orig
,
726 int len
); /* in bytes */
729 FcUtf16Len (const FcChar8
*string
,
731 int len
, /* in bytes */
736 FcStrDirname (const FcChar8
*file
);
739 FcStrBasename (const FcChar8
*file
);
742 FcStrSetCreate (void);
745 FcStrSetMember (FcStrSet
*set
, const FcChar8
*s
);
748 FcStrSetEqual (FcStrSet
*sa
, FcStrSet
*sb
);
751 FcStrSetAdd (FcStrSet
*set
, const FcChar8
*s
);
754 FcStrSetAddFilename (FcStrSet
*set
, const FcChar8
*s
);
757 FcStrSetDel (FcStrSet
*set
, const FcChar8
*s
);
760 FcStrSetDestroy (FcStrSet
*set
);
763 FcStrListCreate (FcStrSet
*set
);
766 FcStrListNext (FcStrList
*list
);
769 FcStrListDone (FcStrList
*list
);
773 FcConfigParseAndLoad (FcConfig
*config
, const FcChar8
*file
, FcBool complain
);
777 #endif /* _FONTCONFIG_H_ */