2 * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.23 2002/07/28 10:50:58 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
{
115 typedef struct _FcMatrix
{
116 double xx
, xy
, yx
, yy
;
119 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
120 (m)->xy = (m)->yx = 0)
123 * A data structure to represent the available glyphs in a font.
124 * This is represented as a sparse boolean btree.
127 typedef struct _FcCharSet FcCharSet
;
129 typedef struct _FcObjectType
{
134 typedef struct _FcConstant
{
140 typedef enum _FcResult
{
141 FcResultMatch
, FcResultNoMatch
, FcResultTypeMismatch
, FcResultNoId
144 typedef struct _FcValue
{
157 typedef struct _FcPattern FcPattern
;
159 typedef struct _FcFontSet
{
165 typedef struct _FcObjectSet
{
168 const char **objects
;
171 typedef enum _FcMatchKind
{
172 FcMatchPattern
, FcMatchFont
175 typedef enum _FcSetName
{
180 typedef struct _FcAtomic FcAtomic
;
182 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
183 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
184 #define _FCFUNCPROTOEND }
186 #define _FCFUNCPROTOBEGIN
187 #define _FCFUNCPROTOEND
190 typedef enum { FcEndianBig
, FcEndianLittle
} FcEndian
;
192 typedef struct _FcConfig FcConfig
;
194 typedef struct _FcGlobalCache FcFileCache
;
196 typedef struct _FcBlanks FcBlanks
;
198 typedef struct _FcStrList FcStrList
;
200 typedef struct _FcStrSet FcStrSet
;
205 FcDirCacheValid (const FcChar8
*cache_file
);
209 FcBlanksCreate (void);
212 FcBlanksDestroy (FcBlanks
*b
);
215 FcBlanksAdd (FcBlanks
*b
, FcChar32 ucs4
);
218 FcBlanksIsMember (FcBlanks
*b
, FcChar32 ucs4
);
222 FcConfigFilename (const FcChar8
*url
);
225 FcConfigCreate (void);
228 FcConfigDestroy (FcConfig
*config
);
231 FcConfigSetCurrent (FcConfig
*config
);
234 FcConfigGetCurrent (void);
237 FcConfigUptoDate (FcConfig
*config
);
240 FcConfigBuildFonts (FcConfig
*config
);
243 FcConfigGetFontDirs (FcConfig
*config
);
246 FcConfigGetConfigDirs (FcConfig
*config
);
249 FcConfigGetConfigFiles (FcConfig
*config
);
252 FcConfigGetCache (FcConfig
*config
);
255 FcConfigGetBlanks (FcConfig
*config
);
258 FcConfigGetRescanInverval (FcConfig
*config
);
261 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
);
264 FcConfigGetFonts (FcConfig
*config
,
268 FcConfigAppFontAddFile (FcConfig
*config
,
269 const FcChar8
*file
);
272 FcConfigAppFontAddDir (FcConfig
*config
,
276 FcConfigAppFontClear (FcConfig
*config
);
279 FcConfigSubstitute (FcConfig
*config
,
285 FcCharSetCreate (void);
288 FcCharSetDestroy (FcCharSet
*fcs
);
291 FcCharSetAddChar (FcCharSet
*fcs
, FcChar32 ucs4
);
294 FcCharSetCopy (FcCharSet
*src
);
297 FcCharSetEqual (const FcCharSet
*a
, const FcCharSet
*b
);
300 FcCharSetIntersect (const FcCharSet
*a
, const FcCharSet
*b
);
303 FcCharSetUnion (const FcCharSet
*a
, const FcCharSet
*b
);
306 FcCharSetSubtract (const FcCharSet
*a
, const FcCharSet
*b
);
309 FcCharSetHasChar (const FcCharSet
*fcs
, FcChar32 ucs4
);
312 FcCharSetCount (const FcCharSet
*a
);
315 FcCharSetIntersectCount (const FcCharSet
*a
, const FcCharSet
*b
);
318 FcCharSetSubtractCount (const FcCharSet
*a
, const FcCharSet
*b
);
321 FcCharSetIsSubset (const FcCharSet
*a
, const FcCharSet
*b
);
323 #define FC_CHARSET_MAP_SIZE (256/32)
324 #define FC_CHARSET_DONE ((FcChar32) -1)
327 FcCharSetFirstPage (const FcCharSet
*a
,
328 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
332 FcCharSetNextPage (const FcCharSet
*a
,
333 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
339 FcValuePrint (FcValue v
);
342 FcPatternPrint (FcPattern
*p
);
345 FcFontSetPrint (FcFontSet
*s
);
349 FcDefaultSubstitute (FcPattern
*pattern
);
353 FcFileScan (FcFontSet
*set
,
361 FcDirScan (FcFontSet
*set
,
369 FcDirSave (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
);
373 FcFreeTypeQuery (const FcChar8
*file
, int id
, FcBlanks
*blanks
, int *count
);
378 FcFontSetCreate (void);
381 FcFontSetDestroy (FcFontSet
*s
);
384 FcFontSetAdd (FcFontSet
*s
, FcPattern
*font
);
388 FcInitLoadConfig (void);
391 FcInitLoadConfigAndFonts (void);
400 FcInitReinitialize (void);
403 FcInitBringUptoDate (void);
407 FcObjectSetCreate (void);
410 FcObjectSetAdd (FcObjectSet
*os
, const char *object
);
413 FcObjectSetDestroy (FcObjectSet
*os
);
416 FcObjectSetVaBuild (const char *first
, va_list va
);
419 FcObjectSetBuild (const char *first
, ...);
422 FcFontSetList (FcConfig
*config
,
429 FcFontList (FcConfig
*config
,
436 FcAtomicCreate (const FcChar8
*file
);
439 FcAtomicLock (FcAtomic
*atomic
);
442 FcAtomicNewFile (FcAtomic
*atomic
);
445 FcAtomicOrigFile (FcAtomic
*atomic
);
448 FcAtomicReplaceOrig (FcAtomic
*atomic
);
451 FcAtomicDeleteNew (FcAtomic
*atomic
);
454 FcAtomicUnlock (FcAtomic
*atomic
);
457 FcAtomicDestroy (FcAtomic
*atomic
);
461 FcFontSetMatch (FcConfig
*config
,
468 FcFontMatch (FcConfig
*config
,
473 FcFontRenderPrepare (FcConfig
*config
,
478 FcFontSetSort (FcConfig
*config
,
487 FcFontSort (FcConfig
*config
,
494 FcFontSetSortDestroy (FcFontSet
*fs
);
498 FcMatrixCopy (const FcMatrix
*mat
);
501 FcMatrixEqual (const FcMatrix
*mat1
, const FcMatrix
*mat2
);
504 FcMatrixMultiply (FcMatrix
*result
, const FcMatrix
*a
, const FcMatrix
*b
);
507 FcMatrixRotate (FcMatrix
*m
, double c
, double s
);
510 FcMatrixScale (FcMatrix
*m
, double sx
, double sy
);
513 FcMatrixShear (FcMatrix
*m
, double sh
, double sv
);
518 FcNameRegisterObjectTypes (const FcObjectType
*types
, int ntype
);
521 FcNameUnregisterObjectTypes (const FcObjectType
*types
, int ntype
);
524 FcNameGetObjectType (const char *object
);
527 FcNameRegisterConstants (const FcConstant
*consts
, int nconsts
);
530 FcNameUnregisterConstants (const FcConstant
*consts
, int nconsts
);
533 FcNameGetConstant (FcChar8
*string
);
536 FcNameConstant (FcChar8
*string
, int *result
);
539 FcNameParse (const FcChar8
*name
);
542 FcNameUnparse (FcPattern
*pat
);
546 FcPatternCreate (void);
549 FcPatternDuplicate (FcPattern
*p
);
552 FcPatternReference (FcPattern
*p
);
555 FcValueDestroy (FcValue v
);
558 FcValueEqual (FcValue va
, FcValue vb
);
561 FcValueSave (FcValue v
);
564 FcPatternDestroy (FcPattern
*p
);
567 FcPatternEqual (const FcPattern
*pa
, const FcPattern
*pb
);
570 FcPatternEqualSubset (const FcPattern
*pa
, const FcPattern
*pb
, const FcObjectSet
*os
);
573 FcPatternHash (const FcPattern
*p
);
576 FcPatternAdd (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
579 FcPatternAddWeak (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
582 FcPatternGet (FcPattern
*p
, const char *object
, int id
, FcValue
*v
);
585 FcPatternDel (FcPattern
*p
, const char *object
);
588 FcPatternAddInteger (FcPattern
*p
, const char *object
, int i
);
591 FcPatternAddDouble (FcPattern
*p
, const char *object
, double d
);
594 FcPatternAddString (FcPattern
*p
, const char *object
, const FcChar8
*s
);
597 FcPatternAddMatrix (FcPattern
*p
, const char *object
, const FcMatrix
*s
);
600 FcPatternAddCharSet (FcPattern
*p
, const char *object
, const FcCharSet
*c
);
603 FcPatternAddBool (FcPattern
*p
, const char *object
, FcBool b
);
606 FcPatternGetInteger (FcPattern
*p
, const char *object
, int n
, int *i
);
609 FcPatternGetDouble (FcPattern
*p
, const char *object
, int n
, double *d
);
612 FcPatternGetString (FcPattern
*p
, const char *object
, int n
, FcChar8
** s
);
615 FcPatternGetMatrix (FcPattern
*p
, const char *object
, int n
, FcMatrix
**s
);
618 FcPatternGetCharSet (FcPattern
*p
, const char *object
, int n
, FcCharSet
**c
);
621 FcPatternGetBool (FcPattern
*p
, const char *object
, int n
, FcBool
*b
);
624 FcPatternVaBuild (FcPattern
*orig
, va_list va
);
627 FcPatternBuild (FcPattern
*orig
, ...);
632 FcStrCopy (const FcChar8
*s
);
635 FcStrCopyFilename (const FcChar8
*s
);
637 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
640 FcStrCmpIgnoreCase (const FcChar8
*s1
, const FcChar8
*s2
);
643 FcStrCmp (const FcChar8
*s1
, const FcChar8
*s2
);
646 FcUtf8ToUcs4 (FcChar8
*src_orig
,
651 FcUtf8Len (FcChar8
*string
,
656 #define FC_UTF8_MAX_LEN 6
659 FcUcs4ToUtf8 (FcChar32 ucs4
,
660 FcChar8 dest
[FC_UTF8_MAX_LEN
]);
663 FcUtf16ToUcs4 (FcChar8
*src_orig
,
666 int len
); /* in bytes */
669 FcUtf16Len (FcChar8
*string
,
671 int len
, /* in bytes */
676 FcStrDirname (const FcChar8
*file
);
679 FcStrBasename (const FcChar8
*file
);
682 FcStrSetCreate (void);
685 FcStrSetMember (FcStrSet
*set
, const FcChar8
*s
);
688 FcStrSetAdd (FcStrSet
*set
, const FcChar8
*s
);
691 FcStrSetAddFilename (FcStrSet
*set
, const FcChar8
*s
);
694 FcStrSetDel (FcStrSet
*set
, const FcChar8
*s
);
697 FcStrSetDestroy (FcStrSet
*set
);
700 FcStrListCreate (FcStrSet
*set
);
703 FcStrListNext (FcStrList
*list
);
706 FcStrListDone (FcStrList
*list
);
710 FcConfigParseAndLoad (FcConfig
*config
, const FcChar8
*file
, FcBool complain
);
714 #endif /* _FONTCONFIG_H_ */