]> git.wh0rd.org - fontconfig.git/blob - fontconfig/fontconfig.h
Initial revision
[fontconfig.git] / fontconfig / fontconfig.h
1 /*
2 * $XFree86: $
3 *
4 * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
5 *
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.
15 *
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.
23 */
24
25 #ifndef _FONTCONFIG_H_
26 #define _FONTCONFIG_H_
27
28 #include <stdarg.h>
29
30 typedef unsigned char FcChar8;
31 typedef unsigned short FcChar16;
32 typedef unsigned int FcChar32;
33 typedef int FcBool;
34
35 /*
36 * Current Fontconfig version number
37 */
38 #define FC_MAJOR 1
39 #define FC_MINOR 0
40 #define FC_REVISION 0
41
42 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
43
44 #define FcTrue 1
45 #define FcFalse 0
46
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_PIXEL_SIZE "pixelsize" /* Double */
53 #define FC_SPACING "spacing" /* Int */
54 #define FC_FOUNDRY "foundry" /* String */
55 #define FC_ANTIALIAS "antialias" /* Bool (depends) */
56 #define FC_HINTING "hinting" /* Bool (true) */
57 #define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
58 #define FC_AUTOHINT "autohint" /* Bool (false) */
59 #define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
60 #define FC_FILE "file" /* String */
61 #define FC_INDEX "index" /* Int */
62 #define FC_RASTERIZER "rasterizer" /* String */
63 #define FC_OUTLINE "outline" /* Bool */
64 #define FC_SCALABLE "scalable" /* Bool */
65 #define FC_SCALE "scale" /* double */
66 #define FC_DPI "dpi" /* double */
67 #define FC_RGBA "rgba" /* Int */
68 #define FC_MINSPACE "minspace" /* Bool use minimum line spacing */
69 #define FC_SOURCE "source" /* String (X11, freetype) */
70 #define FC_CHARSET "charset" /* CharSet */
71 #define FC_LANG "lang" /* String OS/2 CodePageRange */
72
73 #define FC_DIR_CACHE_FILE "fonts.cache"
74 #define FC_USER_CACHE_FILE ".fonts.cache"
75
76 /* Adjust outline rasterizer */
77 #define FC_CHAR_WIDTH "charwidth" /* Int */
78 #define FC_CHAR_HEIGHT "charheight"/* Int */
79 #define FC_MATRIX "matrix" /* FcMatrix */
80
81 #define FC_WEIGHT_LIGHT 0
82 #define FC_WEIGHT_MEDIUM 100
83 #define FC_WEIGHT_DEMIBOLD 180
84 #define FC_WEIGHT_BOLD 200
85 #define FC_WEIGHT_BLACK 210
86
87 #define FC_SLANT_ROMAN 0
88 #define FC_SLANT_ITALIC 100
89 #define FC_SLANT_OBLIQUE 110
90
91 #define FC_PROPORTIONAL 0
92 #define FC_MONO 100
93 #define FC_CHARCELL 110
94
95 /* sub-pixel order */
96 #define FC_RGBA_NONE 0
97 #define FC_RGBA_RGB 1
98 #define FC_RGBA_BGR 2
99 #define FC_RGBA_VRGB 3
100 #define FC_RGBA_VBGR 4
101
102 /* language groups from the OS/2 CodePageRange bits */
103 #define FC_LANG_LATIN_1 "latin1" /* 0 */
104 #define FC_LANG_LATIN_2_EASTERN_EUROPE "latin2easterneurope" /* 1 */
105 #define FC_LANG_CYRILLIC "cyrillic" /* 2 */
106 #define FC_LANG_GREEK "greek" /* 3 */
107 #define FC_LANG_TURKISH "turkish" /* 4 */
108 #define FC_LANG_HEBREW "hebrew" /* 5 */
109 #define FC_LANG_ARABIC "arabic" /* 6 */
110 #define FC_LANG_WINDOWS_BALTIC "windowsbaltic" /* 7 */
111 #define FC_LANG_VIETNAMESE "vietnamese" /* 8 */
112 /* 9-15 reserved for Alternate ANSI */
113 #define FC_LANG_THAI "thai" /* 16 */
114 #define FC_LANG_JAPANESE "japanese" /* 17 */
115 #define FC_LANG_SIMPLIFIED_CHINESE "simplifiedchinese" /* 18 */
116 #define FC_LANG_KOREAN_WANSUNG "koreanwansung" /* 19 */
117 #define FC_LANG_TRADITIONAL_CHINESE "traditionalchinese" /* 20 */
118 #define FC_LANG_KOREAN_JOHAB "koreanjohab" /* 21 */
119 /* 22-28 reserved for Alternate ANSI & OEM */
120 #define FC_LANG_MACINTOSH "macintosh" /* 29 */
121 #define FC_LANG_OEM "oem" /* 30 */
122 #define FC_LANG_SYMBOL "symbol" /* 31 */
123 /* 32-47 reserved for OEM */
124 #define FC_LANG_IBM_GREEK "ibmgreek" /* 48 */
125 #define FC_LANG_MSDOS_RUSSIAN "msdosrussian" /* 49 */
126 #define FC_LANG_MSDOS_NORDIC "msdosnordic" /* 50 */
127 #define FC_LANG_ARABIC_864 "arabic864" /* 51 */
128 #define FC_LANG_MSDOS_CANADIAN_FRENCH "msdoscanadianfrench" /* 52 */
129 #define FC_LANG_HEBREW_862 "hebrew862" /* 53 */
130 #define FC_LANG_MSDOS_ICELANDIC "msdosicelandic" /* 54 */
131 #define FC_LANG_MSDOS_PORTUGUESE "msdosportuguese" /* 55 */
132 #define FC_LANG_IBM_TURKISH "ibmturkish" /* 56 */
133 #define FC_LANG_IBM_CYRILLIC "ibmcyrillic" /* 57 */
134 #define FC_LANG_LATIN_2 "latin2" /* 58 */
135 #define FC_LANG_MSDOS_BALTIC "msdosbaltic" /* 59 */
136 #define FC_LANG_GREEK_437_G "greek437g" /* 60 */
137 #define FC_LANG_ARABIC_ASMO_708 "arabicasmo708" /* 61 */
138 #define FC_LANG_WE_LATIN_1 "welatin1" /* 62 */
139 #define FC_LANG_US "us" /* 63 */
140
141 typedef enum _FcType {
142 FcTypeVoid,
143 FcTypeInteger,
144 FcTypeDouble,
145 FcTypeString,
146 FcTypeBool,
147 FcTypeMatrix,
148 FcTypeCharSet
149 } FcType;
150
151 typedef struct _FcMatrix {
152 double xx, xy, yx, yy;
153 } FcMatrix;
154
155 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
156 (m)->xy = (m)->yx = 0)
157
158 /*
159 * A data structure to represent the available glyphs in a font.
160 * This is represented as a sparse boolean btree.
161 */
162
163 typedef struct _FcCharSet FcCharSet;
164
165 typedef struct _FcObjectType {
166 const char *object;
167 FcType type;
168 } FcObjectType;
169
170 typedef struct _FcConstant {
171 const char *name;
172 const char *object;
173 int value;
174 } FcConstant;
175
176 typedef enum _FcResult {
177 FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId
178 } FcResult;
179
180 typedef struct _FcValue {
181 FcType type;
182 union {
183 const FcChar8 *s;
184 int i;
185 FcBool b;
186 double d;
187 const FcMatrix *m;
188 const FcCharSet *c;
189 } u;
190 } FcValue;
191
192 typedef struct _FcPattern FcPattern;
193
194 typedef struct _FcFontSet {
195 int nfont;
196 int sfont;
197 FcPattern **fonts;
198 } FcFontSet;
199
200 typedef struct _FcObjectSet {
201 int nobject;
202 int sobject;
203 const char **objects;
204 } FcObjectSet;
205
206 typedef enum _FcMatchKind {
207 FcMatchPattern, FcMatchFont
208 } FcMatchKind;
209
210 typedef enum _FcSetName {
211 FcSetSystem = 0,
212 FcSetApplication = 1
213 } FcSetName;
214
215 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
216 #define _FCFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
217 #define _FCFUNCPROTOEND }
218 #else
219 #define _FCFUNCPROTOBEGIN
220 #define _FCFUNCPROTOEND
221 #endif
222
223 typedef struct _FcConfig FcConfig;
224
225 typedef struct _FcFileCache FcFileCache;
226
227 typedef struct _FcBlanks FcBlanks;
228
229 _FCFUNCPROTOBEGIN
230
231 /* fcblanks.c */
232 FcBlanks *
233 FcBlanksCreate (void);
234
235 void
236 FcBlanksDestroy (FcBlanks *b);
237
238 FcBool
239 FcBlanksAdd (FcBlanks *b, FcChar32 ucs4);
240
241 FcBool
242 FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
243
244 /* fccfg.c */
245 char *
246 FcConfigFilename (const char *url);
247
248 FcConfig *
249 FcConfigCreate (void);
250
251 void
252 FcConfigDestroy (FcConfig *config);
253
254 FcBool
255 FcConfigSetCurrent (FcConfig *config);
256
257 FcConfig *
258 FcConfigGetCurrent (void);
259
260 FcBool
261 FcConfigBuildFonts (FcConfig *config);
262
263 char **
264 FcConfigGetDirs (FcConfig *config);
265
266 char **
267 FcConfigGetConfigFiles (FcConfig *config);
268
269 char *
270 FcConfigGetCache (FcConfig *config);
271
272 FcBlanks *
273 FcConfigGetBlanks (FcConfig *config);
274
275 FcFontSet *
276 FcConfigGetFonts (FcConfig *config,
277 FcSetName set);
278
279 FcBool
280 FcConfigAppFontAddFile (FcConfig *config,
281 const char *file);
282
283 FcBool
284 FcConfigAppFontAddDir (FcConfig *config,
285 const char *dir);
286
287 void
288 FcConfigAppFontClear (FcConfig *config);
289
290 FcBool
291 FcConfigSubstitute (FcConfig *config,
292 FcPattern *p,
293 FcMatchKind kind);
294
295 /* fccharset.c */
296 FcCharSet *
297 FcCharSetCreate (void);
298
299 void
300 FcCharSetDestroy (FcCharSet *fcs);
301
302 FcBool
303 FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
304
305 FcCharSet *
306 FcCharSetCopy (FcCharSet *src);
307
308 FcBool
309 FcCharSetEqual (const FcCharSet *a, const FcCharSet *b);
310
311 FcCharSet *
312 FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b);
313
314 FcCharSet *
315 FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
316
317 FcCharSet *
318 FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b);
319
320 FcBool
321 FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4);
322
323 FcChar32
324 FcCharSetCount (const FcCharSet *a);
325
326 FcChar32
327 FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
328
329 FcChar32
330 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
331
332 #ifndef FONTCONFIG_NO_FREETYPE
333 #include <freetype/freetype.h>
334 FT_UInt
335 FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
336 #endif
337
338 /* fcdbg.c */
339 void
340 FcPatternPrint (FcPattern *p);
341
342 /* fcdefault.c */
343 void
344 FcDefaultSubstitute (FcPattern *pattern);
345
346 /* fcdir.c */
347 FcBool
348 FcDirScan (FcFontSet *set,
349 FcFileCache *cache,
350 FcBlanks *blanks,
351 const char *dir,
352 FcBool force);
353
354 FcBool
355 FcDirSave (FcFontSet *set, const char *dir);
356
357 /* fcfreetype.c */
358 FcPattern *
359 FcFreeTypeQuery (const char *file, int id, FcBlanks *blanks, int *count);
360
361 /* fcfs.c */
362
363 FcFontSet *
364 FcFontSetCreate (void);
365
366 void
367 FcFontSetDestroy (FcFontSet *s);
368
369 FcBool
370 FcFontSetAdd (FcFontSet *s, FcPattern *font);
371
372 /* fcinit.c */
373 FcBool
374 FcInitFonts (void);
375
376 FcBool
377 FcInitConfig (void);
378
379 FcBool
380 FcInit (void);
381
382 /* fclist.c */
383 FcObjectSet *
384 FcObjectSetCreate (void);
385
386 FcBool
387 FcObjectSetAdd (FcObjectSet *os, const char *object);
388
389 void
390 FcObjectSetDestroy (FcObjectSet *os);
391
392 FcObjectSet *
393 FcObjectSetVaBuild (const char *first, va_list va);
394
395 FcObjectSet *
396 FcObjectSetBuild (const char *first, ...);
397
398 FcFontSet *
399 FcFontList (FcConfig *config,
400 FcPattern *p,
401 FcObjectSet *os);
402
403 /* fcmatch.c */
404 FcPattern *
405 FcFontMatch (FcConfig *config,
406 FcPattern *p,
407 FcResult *result);
408
409 /* fcmatrix.c */
410 FcMatrix *
411 FcMatrixCopy (const FcMatrix *mat);
412
413 FcBool
414 FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2);
415
416 void
417 FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b);
418
419 void
420 FcMatrixRotate (FcMatrix *m, double c, double s);
421
422 void
423 FcMatrixScale (FcMatrix *m, double sx, double sy);
424
425 void
426 FcMatrixShear (FcMatrix *m, double sh, double sv);
427
428 /* fcname.c */
429
430 FcBool
431 FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
432
433 FcBool
434 FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
435
436 const FcObjectType *
437 FcNameGetObjectType (const char *object);
438
439 FcBool
440 FcNameRegisterConstants (const FcConstant *consts, int nconsts);
441
442 FcBool
443 FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
444
445 const FcConstant *
446 FcNameGetConstant (char *string);
447
448 FcBool
449 FcNameConstant (char *string, int *result);
450
451 FcPattern *
452 FcNameParse (const char *name);
453
454 FcChar8 *
455 FcNameUnparse (FcPattern *pat);
456
457 /* fcpat.c */
458 FcPattern *
459 FcPatternCreate (void);
460
461 FcPattern *
462 FcPatternDuplicate (FcPattern *p);
463
464 void
465 FcValueDestroy (FcValue v);
466
467 FcValue
468 FcValueSave (FcValue v);
469
470 void
471 FcPatternDestroy (FcPattern *p);
472
473 FcBool
474 FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
475
476 FcResult
477 FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v);
478
479 FcBool
480 FcPatternDel (FcPattern *p, const char *object);
481
482 FcBool
483 FcPatternAddInteger (FcPattern *p, const char *object, int i);
484
485 FcBool
486 FcPatternAddDouble (FcPattern *p, const char *object, double d);
487
488 FcBool
489 FcPatternAddString (FcPattern *p, const char *object, const char *s);
490
491 FcBool
492 FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
493
494 FcBool
495 FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
496
497 FcBool
498 FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
499
500 FcResult
501 FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
502
503 FcResult
504 FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
505
506 FcResult
507 FcPatternGetString (FcPattern *p, const char *object, int n, char **const s);
508
509 FcResult
510 FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
511
512 FcResult
513 FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
514
515 FcResult
516 FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
517
518 FcPattern *
519 FcPatternVaBuild (FcPattern *orig, va_list va);
520
521 FcPattern *
522 FcPatternBuild (FcPattern *orig, ...);
523
524 /* fcstr.c */
525
526 char *
527 FcStrCopy (const char *s);
528
529 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
530
531 int
532 FcStrCmpIgnoreCase (const char *s1, const char *s2);
533
534 int
535 FcUtf8ToUcs4 (FcChar8 *src_orig,
536 FcChar32 *dst,
537 int len);
538
539 FcBool
540 FcUtf8Len (FcChar8 *string,
541 int len,
542 int *nchar,
543 int *wchar);
544
545 /* fcxml.c */
546 FcBool
547 FcConfigParseAndLoad (FcConfig *config, const char *file, FcBool complain);
548
549 _FCFUNCPROTOEND
550
551 #endif /* _FONTCONFIG_H_ */