2 * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.28 2002/08/24 20:08:53 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_NONE 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
117 typedef enum _FcType
{
129 typedef struct _FcMatrix
{
130 double xx
, xy
, yx
, yy
;
133 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
134 (m)->xy = (m)->yx = 0)
137 * A data structure to represent the available glyphs in a font.
138 * This is represented as a sparse boolean btree.
141 typedef struct _FcCharSet FcCharSet
;
143 typedef struct _FcObjectType
{
148 typedef struct _FcConstant
{
154 typedef enum _FcResult
{
155 FcResultMatch
, FcResultNoMatch
, FcResultTypeMismatch
, FcResultNoId
158 typedef struct _FcPattern FcPattern
;
160 typedef struct _FcLangSet FcLangSet
;
162 typedef struct _FcValue
{
177 typedef struct _FcFontSet
{
183 typedef struct _FcObjectSet
{
186 const char **objects
;
189 typedef enum _FcMatchKind
{
190 FcMatchPattern
, FcMatchFont
193 typedef enum _FcLangResult
{
194 FcLangEqual
, FcLangDifferentCountry
, FcLangDifferentLang
197 typedef enum _FcSetName
{
202 typedef struct _FcAtomic FcAtomic
;
204 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
205 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
206 #define _FCFUNCPROTOEND }
208 #define _FCFUNCPROTOBEGIN
209 #define _FCFUNCPROTOEND
212 typedef enum { FcEndianBig
, FcEndianLittle
} FcEndian
;
214 typedef struct _FcConfig FcConfig
;
216 typedef struct _FcGlobalCache FcFileCache
;
218 typedef struct _FcBlanks FcBlanks
;
220 typedef struct _FcStrList FcStrList
;
222 typedef struct _FcStrSet FcStrSet
;
227 FcDirCacheValid (const FcChar8
*cache_file
);
231 FcBlanksCreate (void);
234 FcBlanksDestroy (FcBlanks
*b
);
237 FcBlanksAdd (FcBlanks
*b
, FcChar32 ucs4
);
240 FcBlanksIsMember (FcBlanks
*b
, FcChar32 ucs4
);
244 FcConfigFilename (const FcChar8
*url
);
247 FcConfigCreate (void);
250 FcConfigDestroy (FcConfig
*config
);
253 FcConfigSetCurrent (FcConfig
*config
);
256 FcConfigGetCurrent (void);
259 FcConfigUptoDate (FcConfig
*config
);
262 FcConfigBuildFonts (FcConfig
*config
);
265 FcConfigGetFontDirs (FcConfig
*config
);
268 FcConfigGetConfigDirs (FcConfig
*config
);
271 FcConfigGetConfigFiles (FcConfig
*config
);
274 FcConfigGetCache (FcConfig
*config
);
277 FcConfigGetBlanks (FcConfig
*config
);
280 FcConfigGetRescanInverval (FcConfig
*config
);
283 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
);
286 FcConfigGetFonts (FcConfig
*config
,
290 FcConfigAppFontAddFile (FcConfig
*config
,
291 const FcChar8
*file
);
294 FcConfigAppFontAddDir (FcConfig
*config
,
298 FcConfigAppFontClear (FcConfig
*config
);
301 FcConfigSubstituteWithPat (FcConfig
*config
,
307 FcConfigSubstitute (FcConfig
*config
,
313 FcCharSetCreate (void);
316 FcCharSetDestroy (FcCharSet
*fcs
);
319 FcCharSetAddChar (FcCharSet
*fcs
, FcChar32 ucs4
);
322 FcCharSetCopy (FcCharSet
*src
);
325 FcCharSetEqual (const FcCharSet
*a
, const FcCharSet
*b
);
328 FcCharSetIntersect (const FcCharSet
*a
, const FcCharSet
*b
);
331 FcCharSetUnion (const FcCharSet
*a
, const FcCharSet
*b
);
334 FcCharSetSubtract (const FcCharSet
*a
, const FcCharSet
*b
);
337 FcCharSetHasChar (const FcCharSet
*fcs
, FcChar32 ucs4
);
340 FcCharSetCount (const FcCharSet
*a
);
343 FcCharSetIntersectCount (const FcCharSet
*a
, const FcCharSet
*b
);
346 FcCharSetSubtractCount (const FcCharSet
*a
, const FcCharSet
*b
);
349 FcCharSetIsSubset (const FcCharSet
*a
, const FcCharSet
*b
);
351 #define FC_CHARSET_MAP_SIZE (256/32)
352 #define FC_CHARSET_DONE ((FcChar32) -1)
355 FcCharSetFirstPage (const FcCharSet
*a
,
356 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
360 FcCharSetNextPage (const FcCharSet
*a
,
361 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
367 FcValuePrint (const FcValue v
);
370 FcPatternPrint (const FcPattern
*p
);
373 FcFontSetPrint (const FcFontSet
*s
);
377 FcDefaultSubstitute (FcPattern
*pattern
);
381 FcFileScan (FcFontSet
*set
,
389 FcDirScan (FcFontSet
*set
,
397 FcDirSave (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
);
401 FcFreeTypeQuery (const FcChar8
*file
, int id
, FcBlanks
*blanks
, int *count
);
406 FcFontSetCreate (void);
409 FcFontSetDestroy (FcFontSet
*s
);
412 FcFontSetAdd (FcFontSet
*s
, FcPattern
*font
);
416 FcInitLoadConfig (void);
419 FcInitLoadConfigAndFonts (void);
428 FcInitReinitialize (void);
431 FcInitBringUptoDate (void);
435 FcLangSetCreate (void);
438 FcLangSetDestroy (FcLangSet
*ls
);
441 FcLangSetCopy (const FcLangSet
*ls
);
444 FcLangSetAdd (FcLangSet
*ls
, const FcChar8
*lang
);
447 FcLangSetHasLang (const FcLangSet
*ls
, const FcChar8
*lang
);
450 FcLangSetCompare (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
453 FcLangSetEqual (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
456 FcLangSetHash (const FcLangSet
*ls
);
460 FcObjectSetCreate (void);
463 FcObjectSetAdd (FcObjectSet
*os
, const char *object
);
466 FcObjectSetDestroy (FcObjectSet
*os
);
469 FcObjectSetVaBuild (const char *first
, va_list va
);
472 FcObjectSetBuild (const char *first
, ...);
475 FcFontSetList (FcConfig
*config
,
482 FcFontList (FcConfig
*config
,
489 FcAtomicCreate (const FcChar8
*file
);
492 FcAtomicLock (FcAtomic
*atomic
);
495 FcAtomicNewFile (FcAtomic
*atomic
);
498 FcAtomicOrigFile (FcAtomic
*atomic
);
501 FcAtomicReplaceOrig (FcAtomic
*atomic
);
504 FcAtomicDeleteNew (FcAtomic
*atomic
);
507 FcAtomicUnlock (FcAtomic
*atomic
);
510 FcAtomicDestroy (FcAtomic
*atomic
);
514 FcFontSetMatch (FcConfig
*config
,
521 FcFontMatch (FcConfig
*config
,
526 FcFontRenderPrepare (FcConfig
*config
,
531 FcFontSetSort (FcConfig
*config
,
540 FcFontSort (FcConfig
*config
,
547 FcFontSetSortDestroy (FcFontSet
*fs
);
551 FcMatrixCopy (const FcMatrix
*mat
);
554 FcMatrixEqual (const FcMatrix
*mat1
, const FcMatrix
*mat2
);
557 FcMatrixMultiply (FcMatrix
*result
, const FcMatrix
*a
, const FcMatrix
*b
);
560 FcMatrixRotate (FcMatrix
*m
, double c
, double s
);
563 FcMatrixScale (FcMatrix
*m
, double sx
, double sy
);
566 FcMatrixShear (FcMatrix
*m
, double sh
, double sv
);
571 FcNameRegisterObjectTypes (const FcObjectType
*types
, int ntype
);
574 FcNameUnregisterObjectTypes (const FcObjectType
*types
, int ntype
);
577 FcNameGetObjectType (const char *object
);
580 FcNameRegisterConstants (const FcConstant
*consts
, int nconsts
);
583 FcNameUnregisterConstants (const FcConstant
*consts
, int nconsts
);
586 FcNameGetConstant (FcChar8
*string
);
589 FcNameConstant (FcChar8
*string
, int *result
);
592 FcNameParse (const FcChar8
*name
);
595 FcNameUnparse (FcPattern
*pat
);
599 FcPatternCreate (void);
602 FcPatternDuplicate (FcPattern
*p
);
605 FcPatternReference (FcPattern
*p
);
608 FcValueDestroy (FcValue v
);
611 FcValueEqual (FcValue va
, FcValue vb
);
614 FcValueSave (FcValue v
);
617 FcPatternDestroy (FcPattern
*p
);
620 FcPatternEqual (const FcPattern
*pa
, const FcPattern
*pb
);
623 FcPatternEqualSubset (const FcPattern
*pa
, const FcPattern
*pb
, const FcObjectSet
*os
);
626 FcPatternHash (const FcPattern
*p
);
629 FcPatternAdd (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
632 FcPatternAddWeak (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
635 FcPatternGet (FcPattern
*p
, const char *object
, int id
, FcValue
*v
);
638 FcPatternDel (FcPattern
*p
, const char *object
);
641 FcPatternAddInteger (FcPattern
*p
, const char *object
, int i
);
644 FcPatternAddDouble (FcPattern
*p
, const char *object
, double d
);
647 FcPatternAddString (FcPattern
*p
, const char *object
, const FcChar8
*s
);
650 FcPatternAddMatrix (FcPattern
*p
, const char *object
, const FcMatrix
*s
);
653 FcPatternAddCharSet (FcPattern
*p
, const char *object
, const FcCharSet
*c
);
656 FcPatternAddBool (FcPattern
*p
, const char *object
, FcBool b
);
659 FcPatternAddLangSet (FcPattern
*p
, const char *object
, const FcLangSet
*ls
);
662 FcPatternGetInteger (FcPattern
*p
, const char *object
, int n
, int *i
);
665 FcPatternGetDouble (FcPattern
*p
, const char *object
, int n
, double *d
);
668 FcPatternGetString (FcPattern
*p
, const char *object
, int n
, FcChar8
** s
);
671 FcPatternGetMatrix (FcPattern
*p
, const char *object
, int n
, FcMatrix
**s
);
674 FcPatternGetCharSet (FcPattern
*p
, const char *object
, int n
, FcCharSet
**c
);
677 FcPatternGetBool (FcPattern
*p
, const char *object
, int n
, FcBool
*b
);
680 FcPatternGetLangSet (FcPattern
*p
, const char *object
, int n
, FcLangSet
**ls
);
683 FcPatternVaBuild (FcPattern
*orig
, va_list va
);
686 FcPatternBuild (FcPattern
*orig
, ...);
691 FcStrCopy (const FcChar8
*s
);
694 FcStrCopyFilename (const FcChar8
*s
);
696 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
699 FcStrCmpIgnoreCase (const FcChar8
*s1
, const FcChar8
*s2
);
702 FcStrCmp (const FcChar8
*s1
, const FcChar8
*s2
);
705 FcUtf8ToUcs4 (const FcChar8
*src_orig
,
710 FcUtf8Len (const FcChar8
*string
,
715 #define FC_UTF8_MAX_LEN 6
718 FcUcs4ToUtf8 (FcChar32 ucs4
,
719 FcChar8 dest
[FC_UTF8_MAX_LEN
]);
722 FcUtf16ToUcs4 (const FcChar8
*src_orig
,
725 int len
); /* in bytes */
728 FcUtf16Len (const FcChar8
*string
,
730 int len
, /* in bytes */
735 FcStrDirname (const FcChar8
*file
);
738 FcStrBasename (const FcChar8
*file
);
741 FcStrSetCreate (void);
744 FcStrSetMember (FcStrSet
*set
, const FcChar8
*s
);
747 FcStrSetEqual (FcStrSet
*sa
, FcStrSet
*sb
);
750 FcStrSetAdd (FcStrSet
*set
, const FcChar8
*s
);
753 FcStrSetAddFilename (FcStrSet
*set
, const FcChar8
*s
);
756 FcStrSetDel (FcStrSet
*set
, const FcChar8
*s
);
759 FcStrSetDestroy (FcStrSet
*set
);
762 FcStrListCreate (FcStrSet
*set
);
765 FcStrListNext (FcStrList
*list
);
768 FcStrListDone (FcStrList
*list
);
772 FcConfigParseAndLoad (FcConfig
*config
, const FcChar8
*file
, FcBool complain
);
776 #endif /* _FONTCONFIG_H_ */