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 */
74 #define FC_PATTERN "pattern" /* FcPattern */
76 #define FC_DIR_CACHE_FILE "fonts.cache"
77 #define FC_USER_CACHE_FILE ".fonts.cache"
79 /* Adjust outline rasterizer */
80 #define FC_CHAR_WIDTH "charwidth" /* Int */
81 #define FC_CHAR_HEIGHT "charheight"/* Int */
82 #define FC_MATRIX "matrix" /* FcMatrix */
84 #define FC_WEIGHT_LIGHT 0
85 #define FC_WEIGHT_MEDIUM 100
86 #define FC_WEIGHT_DEMIBOLD 180
87 #define FC_WEIGHT_BOLD 200
88 #define FC_WEIGHT_BLACK 210
90 #define FC_SLANT_ROMAN 0
91 #define FC_SLANT_ITALIC 100
92 #define FC_SLANT_OBLIQUE 110
94 #define FC_PROPORTIONAL 0
96 #define FC_CHARCELL 110
99 #define FC_RGBA_NONE 0
100 #define FC_RGBA_RGB 1
101 #define FC_RGBA_BGR 2
102 #define FC_RGBA_VRGB 3
103 #define FC_RGBA_VBGR 4
105 typedef enum _FcType
{
117 typedef struct _FcMatrix
{
118 double xx
, xy
, yx
, yy
;
121 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
122 (m)->xy = (m)->yx = 0)
125 * A data structure to represent the available glyphs in a font.
126 * This is represented as a sparse boolean btree.
129 typedef struct _FcCharSet FcCharSet
;
131 typedef struct _FcObjectType
{
136 typedef struct _FcConstant
{
142 typedef enum _FcResult
{
143 FcResultMatch
, FcResultNoMatch
, FcResultTypeMismatch
, FcResultNoId
146 typedef struct _FcPattern FcPattern
;
148 typedef struct _FcValue
{
162 typedef struct _FcFontSet
{
168 typedef struct _FcObjectSet
{
171 const char **objects
;
174 typedef enum _FcMatchKind
{
175 FcMatchPattern
, FcMatchFont
178 typedef enum _FcSetName
{
183 typedef struct _FcAtomic FcAtomic
;
185 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
186 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
187 #define _FCFUNCPROTOEND }
189 #define _FCFUNCPROTOBEGIN
190 #define _FCFUNCPROTOEND
193 typedef enum { FcEndianBig
, FcEndianLittle
} FcEndian
;
195 typedef struct _FcConfig FcConfig
;
197 typedef struct _FcGlobalCache FcFileCache
;
199 typedef struct _FcBlanks FcBlanks
;
201 typedef struct _FcStrList FcStrList
;
203 typedef struct _FcStrSet FcStrSet
;
208 FcDirCacheValid (const FcChar8
*cache_file
);
212 FcBlanksCreate (void);
215 FcBlanksDestroy (FcBlanks
*b
);
218 FcBlanksAdd (FcBlanks
*b
, FcChar32 ucs4
);
221 FcBlanksIsMember (FcBlanks
*b
, FcChar32 ucs4
);
225 FcConfigFilename (const FcChar8
*url
);
228 FcConfigCreate (void);
231 FcConfigDestroy (FcConfig
*config
);
234 FcConfigSetCurrent (FcConfig
*config
);
237 FcConfigGetCurrent (void);
240 FcConfigUptoDate (FcConfig
*config
);
243 FcConfigBuildFonts (FcConfig
*config
);
246 FcConfigGetFontDirs (FcConfig
*config
);
249 FcConfigGetConfigDirs (FcConfig
*config
);
252 FcConfigGetConfigFiles (FcConfig
*config
);
255 FcConfigGetCache (FcConfig
*config
);
258 FcConfigGetBlanks (FcConfig
*config
);
261 FcConfigGetRescanInverval (FcConfig
*config
);
264 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
);
267 FcConfigGetFonts (FcConfig
*config
,
271 FcConfigAppFontAddFile (FcConfig
*config
,
272 const FcChar8
*file
);
275 FcConfigAppFontAddDir (FcConfig
*config
,
279 FcConfigAppFontClear (FcConfig
*config
);
282 FcConfigSubstitute (FcConfig
*config
,
288 FcCharSetCreate (void);
291 FcCharSetDestroy (FcCharSet
*fcs
);
294 FcCharSetAddChar (FcCharSet
*fcs
, FcChar32 ucs4
);
297 FcCharSetCopy (FcCharSet
*src
);
300 FcCharSetEqual (const FcCharSet
*a
, const FcCharSet
*b
);
303 FcCharSetIntersect (const FcCharSet
*a
, const FcCharSet
*b
);
306 FcCharSetUnion (const FcCharSet
*a
, const FcCharSet
*b
);
309 FcCharSetSubtract (const FcCharSet
*a
, const FcCharSet
*b
);
312 FcCharSetHasChar (const FcCharSet
*fcs
, FcChar32 ucs4
);
315 FcCharSetCount (const FcCharSet
*a
);
318 FcCharSetIntersectCount (const FcCharSet
*a
, const FcCharSet
*b
);
321 FcCharSetSubtractCount (const FcCharSet
*a
, const FcCharSet
*b
);
324 FcCharSetIsSubset (const FcCharSet
*a
, const FcCharSet
*b
);
326 #define FC_CHARSET_MAP_SIZE (256/32)
327 #define FC_CHARSET_DONE ((FcChar32) -1)
330 FcCharSetFirstPage (const FcCharSet
*a
,
331 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
335 FcCharSetNextPage (const FcCharSet
*a
,
336 FcChar32 map
[FC_CHARSET_MAP_SIZE
],
342 FcValuePrint (const FcValue v
);
345 FcPatternPrint (const FcPattern
*p
);
348 FcFontSetPrint (const FcFontSet
*s
);
352 FcDefaultSubstitute (FcPattern
*pattern
);
356 FcFileScan (FcFontSet
*set
,
364 FcDirScan (FcFontSet
*set
,
372 FcDirSave (FcFontSet
*set
, FcStrSet
*dirs
, const FcChar8
*dir
);
376 FcFreeTypeQuery (const FcChar8
*file
, int id
, FcBlanks
*blanks
, int *count
);
381 FcFontSetCreate (void);
384 FcFontSetDestroy (FcFontSet
*s
);
387 FcFontSetAdd (FcFontSet
*s
, FcPattern
*font
);
391 FcInitLoadConfig (void);
394 FcInitLoadConfigAndFonts (void);
403 FcInitReinitialize (void);
406 FcInitBringUptoDate (void);
410 FcObjectSetCreate (void);
413 FcObjectSetAdd (FcObjectSet
*os
, const char *object
);
416 FcObjectSetDestroy (FcObjectSet
*os
);
419 FcObjectSetVaBuild (const char *first
, va_list va
);
422 FcObjectSetBuild (const char *first
, ...);
425 FcFontSetList (FcConfig
*config
,
432 FcFontList (FcConfig
*config
,
439 FcAtomicCreate (const FcChar8
*file
);
442 FcAtomicLock (FcAtomic
*atomic
);
445 FcAtomicNewFile (FcAtomic
*atomic
);
448 FcAtomicOrigFile (FcAtomic
*atomic
);
451 FcAtomicReplaceOrig (FcAtomic
*atomic
);
454 FcAtomicDeleteNew (FcAtomic
*atomic
);
457 FcAtomicUnlock (FcAtomic
*atomic
);
460 FcAtomicDestroy (FcAtomic
*atomic
);
464 FcFontSetMatch (FcConfig
*config
,
471 FcFontMatch (FcConfig
*config
,
476 FcFontRenderPrepare (FcConfig
*config
,
481 FcFontSetSort (FcConfig
*config
,
490 FcFontSort (FcConfig
*config
,
497 FcFontSetSortDestroy (FcFontSet
*fs
);
501 FcMatrixCopy (const FcMatrix
*mat
);
504 FcMatrixEqual (const FcMatrix
*mat1
, const FcMatrix
*mat2
);
507 FcMatrixMultiply (FcMatrix
*result
, const FcMatrix
*a
, const FcMatrix
*b
);
510 FcMatrixRotate (FcMatrix
*m
, double c
, double s
);
513 FcMatrixScale (FcMatrix
*m
, double sx
, double sy
);
516 FcMatrixShear (FcMatrix
*m
, double sh
, double sv
);
521 FcNameRegisterObjectTypes (const FcObjectType
*types
, int ntype
);
524 FcNameUnregisterObjectTypes (const FcObjectType
*types
, int ntype
);
527 FcNameGetObjectType (const char *object
);
530 FcNameRegisterConstants (const FcConstant
*consts
, int nconsts
);
533 FcNameUnregisterConstants (const FcConstant
*consts
, int nconsts
);
536 FcNameGetConstant (FcChar8
*string
);
539 FcNameConstant (FcChar8
*string
, int *result
);
542 FcNameParse (const FcChar8
*name
);
545 FcNameUnparse (FcPattern
*pat
);
549 FcPatternCreate (void);
552 FcPatternDuplicate (FcPattern
*p
);
555 FcPatternReference (FcPattern
*p
);
558 FcValueDestroy (FcValue v
);
561 FcValueEqual (FcValue va
, FcValue vb
);
564 FcValueSave (FcValue v
);
567 FcPatternDestroy (FcPattern
*p
);
570 FcPatternEqual (const FcPattern
*pa
, const FcPattern
*pb
);
573 FcPatternEqualSubset (const FcPattern
*pa
, const FcPattern
*pb
, const FcObjectSet
*os
);
576 FcPatternHash (const FcPattern
*p
);
579 FcPatternAdd (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
582 FcPatternAddWeak (FcPattern
*p
, const char *object
, FcValue value
, FcBool append
);
585 FcPatternGet (FcPattern
*p
, const char *object
, int id
, FcValue
*v
);
588 FcPatternDel (FcPattern
*p
, const char *object
);
591 FcPatternAddInteger (FcPattern
*p
, const char *object
, int i
);
594 FcPatternAddDouble (FcPattern
*p
, const char *object
, double d
);
597 FcPatternAddString (FcPattern
*p
, const char *object
, const FcChar8
*s
);
600 FcPatternAddMatrix (FcPattern
*p
, const char *object
, const FcMatrix
*s
);
603 FcPatternAddCharSet (FcPattern
*p
, const char *object
, const FcCharSet
*c
);
606 FcPatternAddBool (FcPattern
*p
, const char *object
, FcBool b
);
609 FcPatternAddPattern (FcPattern
*p
, const char *object
, const FcPattern
*pp
);
612 FcPatternGetInteger (FcPattern
*p
, const char *object
, int n
, int *i
);
615 FcPatternGetDouble (FcPattern
*p
, const char *object
, int n
, double *d
);
618 FcPatternGetString (FcPattern
*p
, const char *object
, int n
, FcChar8
** s
);
621 FcPatternGetMatrix (FcPattern
*p
, const char *object
, int n
, FcMatrix
**s
);
624 FcPatternGetCharSet (FcPattern
*p
, const char *object
, int n
, FcCharSet
**c
);
627 FcPatternGetBool (FcPattern
*p
, const char *object
, int n
, FcBool
*b
);
630 FcPatternGetPattern (FcPattern
*p
, const char *object
, int n
, FcPattern
**pp
);
633 FcPatternVaBuild (FcPattern
*orig
, va_list va
);
636 FcPatternBuild (FcPattern
*orig
, ...);
641 FcStrCopy (const FcChar8
*s
);
644 FcStrCopyFilename (const FcChar8
*s
);
646 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
649 FcStrCmpIgnoreCase (const FcChar8
*s1
, const FcChar8
*s2
);
652 FcStrCmp (const FcChar8
*s1
, const FcChar8
*s2
);
655 FcUtf8ToUcs4 (FcChar8
*src_orig
,
660 FcUtf8Len (FcChar8
*string
,
665 #define FC_UTF8_MAX_LEN 6
668 FcUcs4ToUtf8 (FcChar32 ucs4
,
669 FcChar8 dest
[FC_UTF8_MAX_LEN
]);
672 FcUtf16ToUcs4 (FcChar8
*src_orig
,
675 int len
); /* in bytes */
678 FcUtf16Len (FcChar8
*string
,
680 int len
, /* in bytes */
685 FcStrDirname (const FcChar8
*file
);
688 FcStrBasename (const FcChar8
*file
);
691 FcStrSetCreate (void);
694 FcStrSetMember (FcStrSet
*set
, const FcChar8
*s
);
697 FcStrSetAdd (FcStrSet
*set
, const FcChar8
*s
);
700 FcStrSetAddFilename (FcStrSet
*set
, const FcChar8
*s
);
703 FcStrSetDel (FcStrSet
*set
, const FcChar8
*s
);
706 FcStrSetDestroy (FcStrSet
*set
);
709 FcStrListCreate (FcStrSet
*set
);
712 FcStrListNext (FcStrList
*list
);
715 FcStrListDone (FcStrList
*list
);
719 FcConfigParseAndLoad (FcConfig
*config
, const FcChar8
*file
, FcBool complain
);
723 #endif /* _FONTCONFIG_H_ */