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
43 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
46 * Current font cache file format version
47 * This is appended to the cache files so that multiple
48 * versions of the library will peacefully coexist
50 * Change this value whenever the disk format for the cache file
51 * changes in any non-compatible way. Try to avoid such changes as
52 * it means multiple copies of the font information.
55 #define FC_CACHE_VERSION "1"
60 #define FC_FAMILY "family" /* String */
61 #define FC_STYLE "style" /* String */
62 #define FC_SLANT "slant" /* Int */
63 #define FC_WEIGHT "weight" /* Int */
64 #define FC_SIZE "size" /* Double */
65 #define FC_ASPECT "aspect" /* Double */
66 #define FC_PIXEL_SIZE "pixelsize" /* Double */
67 #define FC_SPACING "spacing" /* Int */
68 #define FC_FOUNDRY "foundry" /* String */
69 #define FC_ANTIALIAS "antialias" /* Bool (depends) */
70 #define FC_HINTING "hinting" /* Bool (true) */
71 #define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
72 #define FC_AUTOHINT "autohint" /* Bool (false) */
73 #define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
74 #define FC_FILE "file" /* String */
75 #define FC_INDEX "index" /* Int */
76 #define FC_FT_FACE "ftface" /* FT_Face */
77 #define FC_RASTERIZER "rasterizer" /* String */
78 #define FC_OUTLINE "outline" /* Bool */
79 #define FC_SCALABLE "scalable" /* Bool */
80 #define FC_SCALE "scale" /* double */
81 #define FC_DPI "dpi" /* double */
82 #define FC_RGBA "rgba" /* Int */
83 #define FC_MINSPACE "minspace" /* Bool use minimum line spacing */
84 #define FC_SOURCE "source" /* String (X11, freetype) */
85 #define FC_CHARSET "charset" /* CharSet */
86 #define FC_LANG "lang" /* String RFC 3066 langs */
87 #define FC_FONTVERSION "fontversion" /* Int from 'head' table */
89 #define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION
90 #define FC_USER_CACHE_FILE ".fonts.cache-"FC_CACHE_VERSION
92 /* Adjust outline rasterizer */
93 #define FC_CHAR_WIDTH "charwidth" /* Int */
94 #define FC_CHAR_HEIGHT "charheight"/* Int */
95 #define FC_MATRIX "matrix" /* FcMatrix */
97 #define FC_WEIGHT_LIGHT 0
98 #define FC_WEIGHT_MEDIUM 100
99 #define FC_WEIGHT_DEMIBOLD 180
100 #define FC_WEIGHT_BOLD 200
101 #define FC_WEIGHT_BLACK 210
103 #define FC_SLANT_ROMAN 0
104 #define FC_SLANT_ITALIC 100
105 #define FC_SLANT_OBLIQUE 110
107 #define FC_PROPORTIONAL 0
109 #define FC_CHARCELL 110
111 /* sub-pixel order */
112 #define FC_RGBA_UNKNOWN 0
113 #define FC_RGBA_RGB 1
114 #define FC_RGBA_BGR 2
115 #define FC_RGBA_VRGB 3
116 #define FC_RGBA_VBGR 4
117 #define FC_RGBA_NONE 5
119 typedef enum _FcType
{
131 typedef struct _FcMatrix
{
132 double xx
, xy
, yx
, yy
;
135 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
136 (m)->xy = (m)->yx = 0)
139 * A data structure to represent the available glyphs in a font.
140 * This is represented as a sparse boolean btree.
143 typedef struct _FcCharSet FcCharSet
;
145 typedef struct _FcObjectType
{
150 typedef struct _FcConstant
{
156 typedef enum _FcResult
{
157 FcResultMatch
, FcResultNoMatch
, FcResultTypeMismatch
, FcResultNoId
160 typedef struct _FcPattern FcPattern
;
162 typedef struct _FcLangSet FcLangSet
;
164 typedef struct _FcValue
{
179 typedef struct _FcFontSet
{
185 typedef struct _FcObjectSet
{
188 const char **objects
;
191 typedef enum _FcMatchKind
{
192 FcMatchPattern
, FcMatchFont
195 typedef enum _FcLangResult
{
196 FcLangEqual
, FcLangDifferentCountry
, FcLangDifferentLang
199 typedef enum _FcSetName
{
204 typedef struct _FcAtomic FcAtomic
;
206 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
207 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
208 #define _FCFUNCPROTOEND }
210 #define _FCFUNCPROTOBEGIN
211 #define _FCFUNCPROTOEND
214 typedef enum { FcEndianBig
, FcEndianLittle
} FcEndian
;
216 typedef struct _FcConfig FcConfig
;
218 typedef struct _FcGlobalCache FcFileCache
;
220 typedef struct _FcBlanks FcBlanks
;
222 typedef struct _FcStrList FcStrList
;
224 typedef struct _FcStrSet FcStrSet
;
229 FcDirCacheValid (const FcChar8
*cache_file
);
233 FcBlanksCreate (void);
236 FcBlanksDestroy (FcBlanks
*b
);
239 FcBlanksAdd (FcBlanks
*b
, FcChar32 ucs4
);
242 FcBlanksIsMember (FcBlanks
*b
, FcChar32 ucs4
);
246 FcConfigFilename (const FcChar8
*url
);
249 FcConfigCreate (void);
252 FcConfigDestroy (FcConfig
*config
);
255 FcConfigSetCurrent (FcConfig
*config
);
258 FcConfigGetCurrent (void);
261 FcConfigUptoDate (FcConfig
*config
);
264 FcConfigBuildFonts (FcConfig
*config
);
267 FcConfigGetFontDirs (FcConfig
*config
);
270 FcConfigGetConfigDirs (FcConfig
*config
);
273 FcConfigGetConfigFiles (FcConfig
*config
);
276 FcConfigGetCache (FcConfig
*config
);
279 FcConfigGetBlanks (FcConfig
*config
);
282 FcConfigGetRescanInverval (FcConfig
*config
);
285 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
);
288 FcConfigGetFonts (FcConfig
*config
,
292 FcConfigAppFontAddFile (FcConfig
*config
,
293 const FcChar8
*file
);
296 FcConfigAppFontAddDir (FcConfig
*config
,
300 FcConfigAppFontClear (FcConfig
*config
);
303 FcConfigSubstituteWithPat (FcConfig
*config
,
309 FcConfigSubstitute (FcConfig
*config
,
315 FcCharSetCreate (void);
318 FcCharSetDestroy (FcCharSet
*fcs
);
321 FcCharSetAddChar (FcCharSet
*fcs
, FcChar32 ucs4
);
324 FcCharSetCopy (FcCharSet
*src
);
327 FcCharSetEqual (const FcCharSet
*a
, const FcCharSet
*b
);
330 FcCharSetIntersect (const FcCharSet
*a
, const FcCharSet
*b
);
333 FcCharSetUnion (const FcCharSet
*a
, const FcCharSet
*b
);
336 FcCharSetSubtract (const FcCharSet
*a
, const FcCharSet
*b
);
339 FcCharSetHasChar (const FcCharSet
*fcs
, FcChar32 ucs4
);
342 FcCharSetCount (const FcCharSet
*a
);
345 FcCharSetIntersectCount (const FcCharSet
*a
, const FcCharSet
*b
);
348 FcCharSetSubtractCount (const FcCharSet
*a
, const FcCharSet
*b
);
351 FcCharSetIsSubset (const FcCharSet
*a
, const FcCharSet
*b
);
353 #define FC_CHARSET_MAP_SIZE (256/32)
354 #define FC_CHARSET_DONE ((FcChar32) -1)
357 FcCharSetFirstPage (const FcCharSet
*a
,
358 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
362 FcCharSetNextPage (const FcCharSet
*a
,
363 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
369 FcValuePrint (const FcValue v
);
372 FcPatternPrint (const FcPattern
*p
);
375 FcFontSetPrint (const FcFontSet
*s
);
379 FcDefaultSubstitute (FcPattern
*pattern
);
383 FcFileScan (FcFontSet
*set
,
391 FcDirScan (FcFontSet
*set
,
399 FcDirSave (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
);
403 FcFreeTypeQuery (const FcChar8
*file
, int id
, FcBlanks
*blanks
, int *count
);
408 FcFontSetCreate (void);
411 FcFontSetDestroy (FcFontSet
*s
);
414 FcFontSetAdd (FcFontSet
*s
, FcPattern
*font
);
418 FcInitLoadConfig (void);
421 FcInitLoadConfigAndFonts (void);
430 FcInitReinitialize (void);
433 FcInitBringUptoDate (void);
437 FcLangSetCreate (void);
440 FcLangSetDestroy (FcLangSet
*ls
);
443 FcLangSetCopy (const FcLangSet
*ls
);
446 FcLangSetAdd (FcLangSet
*ls
, const FcChar8
*lang
);
449 FcLangSetHasLang (const FcLangSet
*ls
, const FcChar8
*lang
);
452 FcLangSetCompare (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
455 FcLangSetEqual (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
458 FcLangSetHash (const FcLangSet
*ls
);
462 FcObjectSetCreate (void);
465 FcObjectSetAdd (FcObjectSet
*os
, const char *object
);
468 FcObjectSetDestroy (FcObjectSet
*os
);
471 FcObjectSetVaBuild (const char *first
, va_list va
);
474 FcObjectSetBuild (const char *first
, ...);
477 FcFontSetList (FcConfig
*config
,
484 FcFontList (FcConfig
*config
,
491 FcAtomicCreate (const FcChar8
*file
);
494 FcAtomicLock (FcAtomic
*atomic
);
497 FcAtomicNewFile (FcAtomic
*atomic
);
500 FcAtomicOrigFile (FcAtomic
*atomic
);
503 FcAtomicReplaceOrig (FcAtomic
*atomic
);
506 FcAtomicDeleteNew (FcAtomic
*atomic
);
509 FcAtomicUnlock (FcAtomic
*atomic
);
512 FcAtomicDestroy (FcAtomic
*atomic
);
516 FcFontSetMatch (FcConfig
*config
,
523 FcFontMatch (FcConfig
*config
,
528 FcFontRenderPrepare (FcConfig
*config
,
533 FcFontSetSort (FcConfig
*config
,
542 FcFontSort (FcConfig
*config
,
549 FcFontSetSortDestroy (FcFontSet
*fs
);
553 FcMatrixCopy (const FcMatrix
*mat
);
556 FcMatrixEqual (const FcMatrix
*mat1
, const FcMatrix
*mat2
);
559 FcMatrixMultiply (FcMatrix
*result
, const FcMatrix
*a
, const FcMatrix
*b
);
562 FcMatrixRotate (FcMatrix
*m
, double c
, double s
);
565 FcMatrixScale (FcMatrix
*m
, double sx
, double sy
);
568 FcMatrixShear (FcMatrix
*m
, double sh
, double sv
);
573 FcNameRegisterObjectTypes (const FcObjectType
*types
, int ntype
);
576 FcNameUnregisterObjectTypes (const FcObjectType
*types
, int ntype
);
579 FcNameGetObjectType (const char *object
);
582 FcNameRegisterConstants (const FcConstant
*consts
, int nconsts
);
585 FcNameUnregisterConstants (const FcConstant
*consts
, int nconsts
);
588 FcNameGetConstant (FcChar8
*string
);
591 FcNameConstant (FcChar8
*string
, int *result
);
594 FcNameParse (const FcChar8
*name
);
597 FcNameUnparse (FcPattern
*pat
);
601 FcPatternCreate (void);
604 FcPatternDuplicate (const FcPattern
*p
);
607 FcPatternReference (FcPattern
*p
);
610 FcValueDestroy (FcValue v
);
613 FcValueEqual (FcValue va
, FcValue vb
);
616 FcValueSave (FcValue v
);
619 FcPatternDestroy (FcPattern
*p
);
622 FcPatternEqual (const FcPattern
*pa
, const FcPattern
*pb
);
625 FcPatternEqualSubset (const FcPattern
*pa
, const FcPattern
*pb
, const FcObjectSet
*os
);
628 FcPatternHash (const FcPattern
*p
);
631 FcPatternAdd (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
634 FcPatternAddWeak (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
637 FcPatternGet (const FcPattern
*p
, const char *object
, int id
, FcValue
*v
);
640 FcPatternDel (FcPattern
*p
, const char *object
);
643 FcPatternAddInteger (FcPattern
*p
, const char *object
, int i
);
646 FcPatternAddDouble (FcPattern
*p
, const char *object
, double d
);
649 FcPatternAddString (FcPattern
*p
, const char *object
, const FcChar8
*s
);
652 FcPatternAddMatrix (FcPattern
*p
, const char *object
, const FcMatrix
*s
);
655 FcPatternAddCharSet (FcPattern
*p
, const char *object
, const FcCharSet
*c
);
658 FcPatternAddBool (FcPattern
*p
, const char *object
, FcBool b
);
661 FcPatternAddLangSet (FcPattern
*p
, const char *object
, const FcLangSet
*ls
);
664 FcPatternGetInteger (const FcPattern
*p
, const char *object
, int n
, int *i
);
667 FcPatternGetDouble (const FcPattern
*p
, const char *object
, int n
, double *d
);
670 FcPatternGetString (const FcPattern
*p
, const char *object
, int n
, FcChar8
** s
);
673 FcPatternGetMatrix (const FcPattern
*p
, const char *object
, int n
, FcMatrix
**s
);
676 FcPatternGetCharSet (const FcPattern
*p
, const char *object
, int n
, FcCharSet
**c
);
679 FcPatternGetBool (const FcPattern
*p
, const char *object
, int n
, FcBool
*b
);
682 FcPatternGetLangSet (const FcPattern
*p
, const char *object
, int n
, FcLangSet
**ls
);
685 FcPatternVaBuild (FcPattern
*orig
, va_list va
);
688 FcPatternBuild (FcPattern
*orig
, ...);
693 FcStrCopy (const FcChar8
*s
);
696 FcStrCopyFilename (const FcChar8
*s
);
698 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
701 FcStrCmpIgnoreCase (const FcChar8
*s1
, const FcChar8
*s2
);
704 FcStrCmp (const FcChar8
*s1
, const FcChar8
*s2
);
707 FcUtf8ToUcs4 (const FcChar8
*src_orig
,
712 FcUtf8Len (const FcChar8
*string
,
717 #define FC_UTF8_MAX_LEN 6
720 FcUcs4ToUtf8 (FcChar32 ucs4
,
721 FcChar8 dest
[FC_UTF8_MAX_LEN
]);
724 FcUtf16ToUcs4 (const FcChar8
*src_orig
,
727 int len
); /* in bytes */
730 FcUtf16Len (const FcChar8
*string
,
732 int len
, /* in bytes */
737 FcStrDirname (const FcChar8
*file
);
740 FcStrBasename (const FcChar8
*file
);
743 FcStrSetCreate (void);
746 FcStrSetMember (FcStrSet
*set
, const FcChar8
*s
);
749 FcStrSetEqual (FcStrSet
*sa
, FcStrSet
*sb
);
752 FcStrSetAdd (FcStrSet
*set
, const FcChar8
*s
);
755 FcStrSetAddFilename (FcStrSet
*set
, const FcChar8
*s
);
758 FcStrSetDel (FcStrSet
*set
, const FcChar8
*s
);
761 FcStrSetDestroy (FcStrSet
*set
);
764 FcStrListCreate (FcStrSet
*set
);
767 FcStrListNext (FcStrList
*list
);
770 FcStrListDone (FcStrList
*list
);
774 FcConfigParseAndLoad (FcConfig
*config
, const FcChar8
*file
, FcBool complain
);
778 #endif /* _FONTCONFIG_H_ */