]> git.wh0rd.org - fontconfig.git/blob - fontconfig/fontconfig.h
Remove old FC_LANG constants now that fontconfig uses RFC 3066 based names
[fontconfig.git] / fontconfig / fontconfig.h
1 /*
2 * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.20 2002/07/06 23:47:43 keithp Exp $
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 1
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_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
75 #define FC_DIR_CACHE_FILE "fonts.cache"
76 #define FC_USER_CACHE_FILE ".fonts.cache"
77
78 /* Adjust outline rasterizer */
79 #define FC_CHAR_WIDTH "charwidth" /* Int */
80 #define FC_CHAR_HEIGHT "charheight"/* Int */
81 #define FC_MATRIX "matrix" /* FcMatrix */
82
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
88
89 #define FC_SLANT_ROMAN 0
90 #define FC_SLANT_ITALIC 100
91 #define FC_SLANT_OBLIQUE 110
92
93 #define FC_PROPORTIONAL 0
94 #define FC_MONO 100
95 #define FC_CHARCELL 110
96
97 /* sub-pixel order */
98 #define FC_RGBA_NONE 0
99 #define FC_RGBA_RGB 1
100 #define FC_RGBA_BGR 2
101 #define FC_RGBA_VRGB 3
102 #define FC_RGBA_VBGR 4
103
104 typedef enum _FcType {
105 FcTypeVoid,
106 FcTypeInteger,
107 FcTypeDouble,
108 FcTypeString,
109 FcTypeBool,
110 FcTypeMatrix,
111 FcTypeCharSet,
112 FcTypeFTFace
113 } FcType;
114
115 typedef struct _FcMatrix {
116 double xx, xy, yx, yy;
117 } FcMatrix;
118
119 #define FcMatrixInit(m) ((m)->xx = (m)->yy = 1, \
120 (m)->xy = (m)->yx = 0)
121
122 /*
123 * A data structure to represent the available glyphs in a font.
124 * This is represented as a sparse boolean btree.
125 */
126
127 typedef struct _FcCharSet FcCharSet;
128
129 typedef struct _FcObjectType {
130 const char *object;
131 FcType type;
132 } FcObjectType;
133
134 typedef struct _FcConstant {
135 const FcChar8 *name;
136 const char *object;
137 int value;
138 } FcConstant;
139
140 typedef enum _FcResult {
141 FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId
142 } FcResult;
143
144 typedef struct _FcValue {
145 FcType type;
146 union {
147 const FcChar8 *s;
148 int i;
149 FcBool b;
150 double d;
151 const FcMatrix *m;
152 const FcCharSet *c;
153 void *f;
154 } u;
155 } FcValue;
156
157 typedef struct _FcPattern FcPattern;
158
159 typedef struct _FcFontSet {
160 int nfont;
161 int sfont;
162 FcPattern **fonts;
163 } FcFontSet;
164
165 typedef struct _FcObjectSet {
166 int nobject;
167 int sobject;
168 const char **objects;
169 } FcObjectSet;
170
171 typedef enum _FcMatchKind {
172 FcMatchPattern, FcMatchFont
173 } FcMatchKind;
174
175 typedef enum _FcSetName {
176 FcSetSystem = 0,
177 FcSetApplication = 1
178 } FcSetName;
179
180 typedef struct _FcAtomic FcAtomic;
181
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 }
185 #else
186 #define _FCFUNCPROTOBEGIN
187 #define _FCFUNCPROTOEND
188 #endif
189
190 typedef struct _FcConfig FcConfig;
191
192 typedef struct _FcFileCache FcFileCache;
193
194 typedef struct _FcBlanks FcBlanks;
195
196 typedef struct _FcStrList FcStrList;
197
198 typedef struct _FcStrSet FcStrSet;
199
200 _FCFUNCPROTOBEGIN
201
202 /* fcblanks.c */
203 FcBlanks *
204 FcBlanksCreate (void);
205
206 void
207 FcBlanksDestroy (FcBlanks *b);
208
209 FcBool
210 FcBlanksAdd (FcBlanks *b, FcChar32 ucs4);
211
212 FcBool
213 FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
214
215 /* fccfg.c */
216 FcChar8 *
217 FcConfigFilename (const FcChar8 *url);
218
219 FcConfig *
220 FcConfigCreate (void);
221
222 void
223 FcConfigDestroy (FcConfig *config);
224
225 FcBool
226 FcConfigSetCurrent (FcConfig *config);
227
228 FcConfig *
229 FcConfigGetCurrent (void);
230
231 FcBool
232 FcConfigUptoDate (FcConfig *config);
233
234 FcBool
235 FcConfigBuildFonts (FcConfig *config);
236
237 FcStrList *
238 FcConfigGetFontDirs (FcConfig *config);
239
240 FcStrList *
241 FcConfigGetConfigDirs (FcConfig *config);
242
243 FcStrList *
244 FcConfigGetConfigFiles (FcConfig *config);
245
246 FcChar8 *
247 FcConfigGetCache (FcConfig *config);
248
249 FcBlanks *
250 FcConfigGetBlanks (FcConfig *config);
251
252 int
253 FcConfigGetRescanInverval (FcConfig *config);
254
255 FcBool
256 FcConfigSetRescanInverval (FcConfig *config, int rescanInterval);
257
258 FcFontSet *
259 FcConfigGetFonts (FcConfig *config,
260 FcSetName set);
261
262 FcBool
263 FcConfigAppFontAddFile (FcConfig *config,
264 const FcChar8 *file);
265
266 FcBool
267 FcConfigAppFontAddDir (FcConfig *config,
268 const FcChar8 *dir);
269
270 void
271 FcConfigAppFontClear (FcConfig *config);
272
273 FcBool
274 FcConfigSubstitute (FcConfig *config,
275 FcPattern *p,
276 FcMatchKind kind);
277
278 /* fccharset.c */
279 FcCharSet *
280 FcCharSetCreate (void);
281
282 void
283 FcCharSetDestroy (FcCharSet *fcs);
284
285 FcBool
286 FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
287
288 FcCharSet *
289 FcCharSetCopy (FcCharSet *src);
290
291 FcBool
292 FcCharSetEqual (const FcCharSet *a, const FcCharSet *b);
293
294 FcCharSet *
295 FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b);
296
297 FcCharSet *
298 FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
299
300 FcCharSet *
301 FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b);
302
303 FcBool
304 FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4);
305
306 FcChar32
307 FcCharSetCount (const FcCharSet *a);
308
309 FcChar32
310 FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
311
312 FcChar32
313 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
314
315 FcBool
316 FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b);
317
318 #define FC_CHARSET_MAP_SIZE (256/32)
319 #define FC_CHARSET_DONE ((FcChar32) -1)
320
321 FcChar32
322 FcCharSetFirstPage (const FcCharSet *a,
323 FcChar32 map[FC_CHARSET_MAP_SIZE],
324 FcChar32 *next);
325
326 FcChar32
327 FcCharSetNextPage (const FcCharSet *a,
328 FcChar32 map[FC_CHARSET_MAP_SIZE],
329 FcChar32 *next);
330
331
332 /* fcdbg.c */
333 void
334 FcValuePrint (FcValue v);
335
336 void
337 FcPatternPrint (FcPattern *p);
338
339 void
340 FcFontSetPrint (FcFontSet *s);
341
342 /* fcdefault.c */
343 void
344 FcDefaultSubstitute (FcPattern *pattern);
345
346 /* fcdir.c */
347 FcBool
348 FcFileScan (FcFontSet *set,
349 FcStrSet *dirs,
350 FcFileCache *cache,
351 FcBlanks *blanks,
352 const FcChar8 *file,
353 FcBool force);
354
355 FcBool
356 FcDirScan (FcFontSet *set,
357 FcStrSet *dirs,
358 FcFileCache *cache,
359 FcBlanks *blanks,
360 const FcChar8 *dir,
361 FcBool force);
362
363 FcBool
364 FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
365
366 FcBool
367 FcDirCacheValid (const FcChar8 *dir);
368
369 /* fcfreetype.c */
370 FcPattern *
371 FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
372
373 /* fcfs.c */
374
375 FcFontSet *
376 FcFontSetCreate (void);
377
378 void
379 FcFontSetDestroy (FcFontSet *s);
380
381 FcBool
382 FcFontSetAdd (FcFontSet *s, FcPattern *font);
383
384 /* fcinit.c */
385 FcConfig *
386 FcInitLoadConfig (void);
387
388 FcConfig *
389 FcInitLoadConfigAndFonts (void);
390
391 FcBool
392 FcInit (void);
393
394 int
395 FcGetVersion (void);
396
397 FcBool
398 FcInitReinitialize (void);
399
400 FcBool
401 FcInitBringUptoDate (void);
402
403 /* fclist.c */
404 FcObjectSet *
405 FcObjectSetCreate (void);
406
407 FcBool
408 FcObjectSetAdd (FcObjectSet *os, const char *object);
409
410 void
411 FcObjectSetDestroy (FcObjectSet *os);
412
413 FcObjectSet *
414 FcObjectSetVaBuild (const char *first, va_list va);
415
416 FcObjectSet *
417 FcObjectSetBuild (const char *first, ...);
418
419 FcFontSet *
420 FcFontSetList (FcConfig *config,
421 FcFontSet **sets,
422 int nsets,
423 FcPattern *p,
424 FcObjectSet *os);
425
426 FcFontSet *
427 FcFontList (FcConfig *config,
428 FcPattern *p,
429 FcObjectSet *os);
430
431 /* fcatomic.c */
432
433 FcAtomic *
434 FcAtomicCreate (const FcChar8 *file);
435
436 FcBool
437 FcAtomicLock (FcAtomic *atomic);
438
439 FcChar8 *
440 FcAtomicNewFile (FcAtomic *atomic);
441
442 FcChar8 *
443 FcAtomicOrigFile (FcAtomic *atomic);
444
445 FcBool
446 FcAtomicReplaceOrig (FcAtomic *atomic);
447
448 void
449 FcAtomicDeleteNew (FcAtomic *atomic);
450
451 void
452 FcAtomicUnlock (FcAtomic *atomic);
453
454 void
455 FcAtomicDestroy (FcAtomic *atomic);
456
457 /* fcmatch.c */
458 FcPattern *
459 FcFontSetMatch (FcConfig *config,
460 FcFontSet **sets,
461 int nsets,
462 FcPattern *p,
463 FcResult *result);
464
465 FcPattern *
466 FcFontMatch (FcConfig *config,
467 FcPattern *p,
468 FcResult *result);
469
470 FcPattern *
471 FcFontRenderPrepare (FcConfig *config,
472 FcPattern *pat,
473 FcPattern *font);
474
475 FcFontSet *
476 FcFontSetSort (FcConfig *config,
477 FcFontSet **sets,
478 int nsets,
479 FcPattern *p,
480 FcBool trim,
481 FcCharSet **csp,
482 FcResult *result);
483
484 FcFontSet *
485 FcFontSort (FcConfig *config,
486 FcPattern *p,
487 FcBool trim,
488 FcCharSet **csp,
489 FcResult *result);
490
491 void
492 FcFontSetSortDestroy (FcFontSet *fs);
493
494 /* fcmatrix.c */
495 FcMatrix *
496 FcMatrixCopy (const FcMatrix *mat);
497
498 FcBool
499 FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2);
500
501 void
502 FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b);
503
504 void
505 FcMatrixRotate (FcMatrix *m, double c, double s);
506
507 void
508 FcMatrixScale (FcMatrix *m, double sx, double sy);
509
510 void
511 FcMatrixShear (FcMatrix *m, double sh, double sv);
512
513 /* fcname.c */
514
515 FcBool
516 FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
517
518 FcBool
519 FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
520
521 const FcObjectType *
522 FcNameGetObjectType (const char *object);
523
524 FcBool
525 FcNameRegisterConstants (const FcConstant *consts, int nconsts);
526
527 FcBool
528 FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
529
530 const FcConstant *
531 FcNameGetConstant (FcChar8 *string);
532
533 FcBool
534 FcNameConstant (FcChar8 *string, int *result);
535
536 FcPattern *
537 FcNameParse (const FcChar8 *name);
538
539 FcChar8 *
540 FcNameUnparse (FcPattern *pat);
541
542 /* fcpat.c */
543 FcPattern *
544 FcPatternCreate (void);
545
546 FcPattern *
547 FcPatternDuplicate (FcPattern *p);
548
549 void
550 FcPatternReference (FcPattern *p);
551
552 void
553 FcValueDestroy (FcValue v);
554
555 FcBool
556 FcValueEqual (FcValue va, FcValue vb);
557
558 FcValue
559 FcValueSave (FcValue v);
560
561 void
562 FcPatternDestroy (FcPattern *p);
563
564 FcBool
565 FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
566
567 FcBool
568 FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os);
569
570 FcChar32
571 FcPatternHash (const FcPattern *p);
572
573 FcBool
574 FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
575
576 FcBool
577 FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append);
578
579 FcResult
580 FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v);
581
582 FcBool
583 FcPatternDel (FcPattern *p, const char *object);
584
585 FcBool
586 FcPatternAddInteger (FcPattern *p, const char *object, int i);
587
588 FcBool
589 FcPatternAddDouble (FcPattern *p, const char *object, double d);
590
591 FcBool
592 FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
593
594 FcBool
595 FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
596
597 FcBool
598 FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
599
600 FcBool
601 FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
602
603 FcResult
604 FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
605
606 FcResult
607 FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
608
609 FcResult
610 FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 ** s);
611
612 FcResult
613 FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
614
615 FcResult
616 FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
617
618 FcResult
619 FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
620
621 FcPattern *
622 FcPatternVaBuild (FcPattern *orig, va_list va);
623
624 FcPattern *
625 FcPatternBuild (FcPattern *orig, ...);
626
627 /* fcstr.c */
628
629 FcChar8 *
630 FcStrCopy (const FcChar8 *s);
631
632 FcChar8 *
633 FcStrCopyFilename (const FcChar8 *s);
634
635 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
636
637 int
638 FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
639
640 int
641 FcStrCmp (const FcChar8 *s1, const FcChar8 *s2);
642
643 int
644 FcUtf8ToUcs4 (FcChar8 *src_orig,
645 FcChar32 *dst,
646 int len);
647
648 FcBool
649 FcUtf8Len (FcChar8 *string,
650 int len,
651 int *nchar,
652 int *wchar);
653
654 FcChar8 *
655 FcStrDirname (const FcChar8 *file);
656
657 FcChar8 *
658 FcStrBasename (const FcChar8 *file);
659
660 FcStrSet *
661 FcStrSetCreate (void);
662
663 FcBool
664 FcStrSetMember (FcStrSet *set, const FcChar8 *s);
665
666 FcBool
667 FcStrSetAdd (FcStrSet *set, const FcChar8 *s);
668
669 FcBool
670 FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s);
671
672 FcBool
673 FcStrSetDel (FcStrSet *set, const FcChar8 *s);
674
675 void
676 FcStrSetDestroy (FcStrSet *set);
677
678 FcStrList *
679 FcStrListCreate (FcStrSet *set);
680
681 FcChar8 *
682 FcStrListNext (FcStrList *list);
683
684 void
685 FcStrListDone (FcStrList *list);
686
687 /* fcxml.c */
688 FcBool
689 FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
690
691 _FCFUNCPROTOEND
692
693 #endif /* _FONTCONFIG_H_ */