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 OS/2 CodePageRange */
87 #define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION
88 #define FC_USER_CACHE_FILE ".fonts.cache-"FC_CACHE_VERSION
90 /* Adjust outline rasterizer */
91 #define FC_CHAR_WIDTH "charwidth" /* Int */
92 #define FC_CHAR_HEIGHT "charheight"/* Int */
93 #define FC_MATRIX "matrix" /* FcMatrix */
95 #define FC_WEIGHT_LIGHT 0
96 #define FC_WEIGHT_MEDIUM 100
97 #define FC_WEIGHT_DEMIBOLD 180
98 #define FC_WEIGHT_BOLD 200
99 #define FC_WEIGHT_BLACK 210
101 #define FC_SLANT_ROMAN 0
102 #define FC_SLANT_ITALIC 100
103 #define FC_SLANT_OBLIQUE 110
105 #define FC_PROPORTIONAL 0
107 #define FC_CHARCELL 110
109 /* sub-pixel order */
110 #define FC_RGBA_NONE 0
111 #define FC_RGBA_RGB 1
112 #define FC_RGBA_BGR 2
113 #define FC_RGBA_VRGB 3
114 #define FC_RGBA_VBGR 4
116 typedef enum _FcType
{
128 typedef struct _FcMatrix
{
129 double xx
, xy
, yx
, yy
;
132 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
133 (m)->xy = (m)->yx = 0)
136 * A data structure to represent the available glyphs in a font.
137 * This is represented as a sparse boolean btree.
140 typedef struct _FcCharSet FcCharSet
;
142 typedef struct _FcObjectType
{
147 typedef struct _FcConstant
{
153 typedef enum _FcResult
{
154 FcResultMatch
, FcResultNoMatch
, FcResultTypeMismatch
, FcResultNoId
157 typedef struct _FcPattern FcPattern
;
159 typedef struct _FcLangSet FcLangSet
;
161 typedef struct _FcValue
{
176 typedef struct _FcFontSet
{
182 typedef struct _FcObjectSet
{
185 const char **objects
;
188 typedef enum _FcMatchKind
{
189 FcMatchPattern
, FcMatchFont
192 typedef enum _FcLangResult
{
193 FcLangEqual
, FcLangDifferentCountry
, FcLangDifferentLang
196 typedef enum _FcSetName
{
201 typedef struct _FcAtomic FcAtomic
;
203 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
204 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
205 #define _FCFUNCPROTOEND }
207 #define _FCFUNCPROTOBEGIN
208 #define _FCFUNCPROTOEND
211 typedef enum { FcEndianBig
, FcEndianLittle
} FcEndian
;
213 typedef struct _FcConfig FcConfig
;
215 typedef struct _FcGlobalCache FcFileCache
;
217 typedef struct _FcBlanks FcBlanks
;
219 typedef struct _FcStrList FcStrList
;
221 typedef struct _FcStrSet FcStrSet
;
226 FcDirCacheValid (const FcChar8
*cache_file
);
230 FcBlanksCreate (void);
233 FcBlanksDestroy (FcBlanks
*b
);
236 FcBlanksAdd (FcBlanks
*b
, FcChar32 ucs4
);
239 FcBlanksIsMember (FcBlanks
*b
, FcChar32 ucs4
);
243 FcConfigFilename (const FcChar8
*url
);
246 FcConfigCreate (void);
249 FcConfigDestroy (FcConfig
*config
);
252 FcConfigSetCurrent (FcConfig
*config
);
255 FcConfigGetCurrent (void);
258 FcConfigUptoDate (FcConfig
*config
);
261 FcConfigBuildFonts (FcConfig
*config
);
264 FcConfigGetFontDirs (FcConfig
*config
);
267 FcConfigGetConfigDirs (FcConfig
*config
);
270 FcConfigGetConfigFiles (FcConfig
*config
);
273 FcConfigGetCache (FcConfig
*config
);
276 FcConfigGetBlanks (FcConfig
*config
);
279 FcConfigGetRescanInverval (FcConfig
*config
);
282 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
);
285 FcConfigGetFonts (FcConfig
*config
,
289 FcConfigAppFontAddFile (FcConfig
*config
,
290 const FcChar8
*file
);
293 FcConfigAppFontAddDir (FcConfig
*config
,
297 FcConfigAppFontClear (FcConfig
*config
);
300 FcConfigSubstituteWithPat (FcConfig
*config
,
306 FcConfigSubstitute (FcConfig
*config
,
312 FcCharSetCreate (void);
315 FcCharSetDestroy (FcCharSet
*fcs
);
318 FcCharSetAddChar (FcCharSet
*fcs
, FcChar32 ucs4
);
321 FcCharSetCopy (FcCharSet
*src
);
324 FcCharSetEqual (const FcCharSet
*a
, const FcCharSet
*b
);
327 FcCharSetIntersect (const FcCharSet
*a
, const FcCharSet
*b
);
330 FcCharSetUnion (const FcCharSet
*a
, const FcCharSet
*b
);
333 FcCharSetSubtract (const FcCharSet
*a
, const FcCharSet
*b
);
336 FcCharSetHasChar (const FcCharSet
*fcs
, FcChar32 ucs4
);
339 FcCharSetCount (const FcCharSet
*a
);
342 FcCharSetIntersectCount (const FcCharSet
*a
, const FcCharSet
*b
);
345 FcCharSetSubtractCount (const FcCharSet
*a
, const FcCharSet
*b
);
348 FcCharSetIsSubset (const FcCharSet
*a
, const FcCharSet
*b
);
350 #define FC_CHARSET_MAP_SIZE (256/32)
351 #define FC_CHARSET_DONE ((FcChar32) -1)
354 FcCharSetFirstPage (const FcCharSet
*a
,
355 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
359 FcCharSetNextPage (const FcCharSet
*a
,
360 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
366 FcValuePrint (const FcValue v
);
369 FcPatternPrint (const FcPattern
*p
);
372 FcFontSetPrint (const FcFontSet
*s
);
376 FcDefaultSubstitute (FcPattern
*pattern
);
380 FcFileScan (FcFontSet
*set
,
388 FcDirScan (FcFontSet
*set
,
396 FcDirSave (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
);
400 FcFreeTypeQuery (const FcChar8
*file
, int id
, FcBlanks
*blanks
, int *count
);
405 FcFontSetCreate (void);
408 FcFontSetDestroy (FcFontSet
*s
);
411 FcFontSetAdd (FcFontSet
*s
, FcPattern
*font
);
415 FcInitLoadConfig (void);
418 FcInitLoadConfigAndFonts (void);
427 FcInitReinitialize (void);
430 FcInitBringUptoDate (void);
434 FcLangSetCreate (void);
437 FcLangSetDestroy (FcLangSet
*ls
);
440 FcLangSetCopy (const FcLangSet
*ls
);
443 FcLangSetAdd (FcLangSet
*ls
, const FcChar8
*lang
);
446 FcLangSetHasLang (const FcLangSet
*ls
, const FcChar8
*lang
);
449 FcLangSetCompare (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
452 FcLangSetEqual (const FcLangSet
*lsa
, const FcLangSet
*lsb
);
455 FcLangSetHash (const FcLangSet
*ls
);
459 FcObjectSetCreate (void);
462 FcObjectSetAdd (FcObjectSet
*os
, const char *object
);
465 FcObjectSetDestroy (FcObjectSet
*os
);
468 FcObjectSetVaBuild (const char *first
, va_list va
);
471 FcObjectSetBuild (const char *first
, ...);
474 FcFontSetList (FcConfig
*config
,
481 FcFontList (FcConfig
*config
,
488 FcAtomicCreate (const FcChar8
*file
);
491 FcAtomicLock (FcAtomic
*atomic
);
494 FcAtomicNewFile (FcAtomic
*atomic
);
497 FcAtomicOrigFile (FcAtomic
*atomic
);
500 FcAtomicReplaceOrig (FcAtomic
*atomic
);
503 FcAtomicDeleteNew (FcAtomic
*atomic
);
506 FcAtomicUnlock (FcAtomic
*atomic
);
509 FcAtomicDestroy (FcAtomic
*atomic
);
513 FcFontSetMatch (FcConfig
*config
,
520 FcFontMatch (FcConfig
*config
,
525 FcFontRenderPrepare (FcConfig
*config
,
530 FcFontSetSort (FcConfig
*config
,
539 FcFontSort (FcConfig
*config
,
546 FcFontSetSortDestroy (FcFontSet
*fs
);
550 FcMatrixCopy (const FcMatrix
*mat
);
553 FcMatrixEqual (const FcMatrix
*mat1
, const FcMatrix
*mat2
);
556 FcMatrixMultiply (FcMatrix
*result
, const FcMatrix
*a
, const FcMatrix
*b
);
559 FcMatrixRotate (FcMatrix
*m
, double c
, double s
);
562 FcMatrixScale (FcMatrix
*m
, double sx
, double sy
);
565 FcMatrixShear (FcMatrix
*m
, double sh
, double sv
);
570 FcNameRegisterObjectTypes (const FcObjectType
*types
, int ntype
);
573 FcNameUnregisterObjectTypes (const FcObjectType
*types
, int ntype
);
576 FcNameGetObjectType (const char *object
);
579 FcNameRegisterConstants (const FcConstant
*consts
, int nconsts
);
582 FcNameUnregisterConstants (const FcConstant
*consts
, int nconsts
);
585 FcNameGetConstant (FcChar8
*string
);
588 FcNameConstant (FcChar8
*string
, int *result
);
591 FcNameParse (const FcChar8
*name
);
594 FcNameUnparse (FcPattern
*pat
);
598 FcPatternCreate (void);
601 FcPatternDuplicate (FcPattern
*p
);
604 FcPatternReference (FcPattern
*p
);
607 FcValueDestroy (FcValue v
);
610 FcValueEqual (FcValue va
, FcValue vb
);
613 FcValueSave (FcValue v
);
616 FcPatternDestroy (FcPattern
*p
);
619 FcPatternEqual (const FcPattern
*pa
, const FcPattern
*pb
);
622 FcPatternEqualSubset (const FcPattern
*pa
, const FcPattern
*pb
, const FcObjectSet
*os
);
625 FcPatternHash (const FcPattern
*p
);
628 FcPatternAdd (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
631 FcPatternAddWeak (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
634 FcPatternGet (FcPattern
*p
, const char *object
, int id
, FcValue
*v
);
637 FcPatternDel (FcPattern
*p
, const char *object
);
640 FcPatternAddInteger (FcPattern
*p
, const char *object
, int i
);
643 FcPatternAddDouble (FcPattern
*p
, const char *object
, double d
);
646 FcPatternAddString (FcPattern
*p
, const char *object
, const FcChar8
*s
);
649 FcPatternAddMatrix (FcPattern
*p
, const char *object
, const FcMatrix
*s
);
652 FcPatternAddCharSet (FcPattern
*p
, const char *object
, const FcCharSet
*c
);
655 FcPatternAddBool (FcPattern
*p
, const char *object
, FcBool b
);
658 FcPatternAddLangSet (FcPattern
*p
, const char *object
, const FcLangSet
*ls
);
661 FcPatternGetInteger (FcPattern
*p
, const char *object
, int n
, int *i
);
664 FcPatternGetDouble (FcPattern
*p
, const char *object
, int n
, double *d
);
667 FcPatternGetString (FcPattern
*p
, const char *object
, int n
, FcChar8
** s
);
670 FcPatternGetMatrix (FcPattern
*p
, const char *object
, int n
, FcMatrix
**s
);
673 FcPatternGetCharSet (FcPattern
*p
, const char *object
, int n
, FcCharSet
**c
);
676 FcPatternGetBool (FcPattern
*p
, const char *object
, int n
, FcBool
*b
);
679 FcPatternGetLangSet (FcPattern
*p
, const char *object
, int n
, FcLangSet
**ls
);
682 FcPatternVaBuild (FcPattern
*orig
, va_list va
);
685 FcPatternBuild (FcPattern
*orig
, ...);
690 FcStrCopy (const FcChar8
*s
);
693 FcStrCopyFilename (const FcChar8
*s
);
695 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
698 FcStrCmpIgnoreCase (const FcChar8
*s1
, const FcChar8
*s2
);
701 FcStrCmp (const FcChar8
*s1
, const FcChar8
*s2
);
704 FcUtf8ToUcs4 (const FcChar8
*src_orig
,
709 FcUtf8Len (const FcChar8
*string
,
714 #define FC_UTF8_MAX_LEN 6
717 FcUcs4ToUtf8 (FcChar32 ucs4
,
718 FcChar8 dest
[FC_UTF8_MAX_LEN
]);
721 FcUtf16ToUcs4 (const FcChar8
*src_orig
,
724 int len
); /* in bytes */
727 FcUtf16Len (const FcChar8
*string
,
729 int len
, /* in bytes */
734 FcStrDirname (const FcChar8
*file
);
737 FcStrBasename (const FcChar8
*file
);
740 FcStrSetCreate (void);
743 FcStrSetMember (FcStrSet
*set
, const FcChar8
*s
);
746 FcStrSetEqual (FcStrSet
*sa
, FcStrSet
*sb
);
749 FcStrSetAdd (FcStrSet
*set
, const FcChar8
*s
);
752 FcStrSetAddFilename (FcStrSet
*set
, const FcChar8
*s
);
755 FcStrSetDel (FcStrSet
*set
, const FcChar8
*s
);
758 FcStrSetDestroy (FcStrSet
*set
);
761 FcStrListCreate (FcStrSet
*set
);
764 FcStrListNext (FcStrList
*list
);
767 FcStrListDone (FcStrList
*list
);
771 FcConfigParseAndLoad (FcConfig
*config
, const FcChar8
*file
, FcBool complain
);
775 #endif /* _FONTCONFIG_H_ */