]> git.wh0rd.org - fontconfig.git/blob - fontconfig/fontconfig.h
Warning fix
[fontconfig.git] / fontconfig / fontconfig.h
1 /*
2 * $XFree86: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.23 2002/07/28 10:50:58 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 enum { FcEndianBig, FcEndianLittle } FcEndian;
191
192 typedef struct _FcConfig FcConfig;
193
194 typedef struct _FcGlobalCache FcFileCache;
195
196 typedef struct _FcBlanks FcBlanks;
197
198 typedef struct _FcStrList FcStrList;
199
200 typedef struct _FcStrSet FcStrSet;
201
202 _FCFUNCPROTOBEGIN
203
204 FcBool
205 FcDirCacheValid (const FcChar8 *cache_file);
206
207 /* fcblanks.c */
208 FcBlanks *
209 FcBlanksCreate (void);
210
211 void
212 FcBlanksDestroy (FcBlanks *b);
213
214 FcBool
215 FcBlanksAdd (FcBlanks *b, FcChar32 ucs4);
216
217 FcBool
218 FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
219
220 /* fccfg.c */
221 FcChar8 *
222 FcConfigFilename (const FcChar8 *url);
223
224 FcConfig *
225 FcConfigCreate (void);
226
227 void
228 FcConfigDestroy (FcConfig *config);
229
230 FcBool
231 FcConfigSetCurrent (FcConfig *config);
232
233 FcConfig *
234 FcConfigGetCurrent (void);
235
236 FcBool
237 FcConfigUptoDate (FcConfig *config);
238
239 FcBool
240 FcConfigBuildFonts (FcConfig *config);
241
242 FcStrList *
243 FcConfigGetFontDirs (FcConfig *config);
244
245 FcStrList *
246 FcConfigGetConfigDirs (FcConfig *config);
247
248 FcStrList *
249 FcConfigGetConfigFiles (FcConfig *config);
250
251 FcChar8 *
252 FcConfigGetCache (FcConfig *config);
253
254 FcBlanks *
255 FcConfigGetBlanks (FcConfig *config);
256
257 int
258 FcConfigGetRescanInverval (FcConfig *config);
259
260 FcBool
261 FcConfigSetRescanInverval (FcConfig *config, int rescanInterval);
262
263 FcFontSet *
264 FcConfigGetFonts (FcConfig *config,
265 FcSetName set);
266
267 FcBool
268 FcConfigAppFontAddFile (FcConfig *config,
269 const FcChar8 *file);
270
271 FcBool
272 FcConfigAppFontAddDir (FcConfig *config,
273 const FcChar8 *dir);
274
275 void
276 FcConfigAppFontClear (FcConfig *config);
277
278 FcBool
279 FcConfigSubstitute (FcConfig *config,
280 FcPattern *p,
281 FcMatchKind kind);
282
283 /* fccharset.c */
284 FcCharSet *
285 FcCharSetCreate (void);
286
287 void
288 FcCharSetDestroy (FcCharSet *fcs);
289
290 FcBool
291 FcCharSetAddChar (FcCharSet *fcs, FcChar32 ucs4);
292
293 FcCharSet *
294 FcCharSetCopy (FcCharSet *src);
295
296 FcBool
297 FcCharSetEqual (const FcCharSet *a, const FcCharSet *b);
298
299 FcCharSet *
300 FcCharSetIntersect (const FcCharSet *a, const FcCharSet *b);
301
302 FcCharSet *
303 FcCharSetUnion (const FcCharSet *a, const FcCharSet *b);
304
305 FcCharSet *
306 FcCharSetSubtract (const FcCharSet *a, const FcCharSet *b);
307
308 FcBool
309 FcCharSetHasChar (const FcCharSet *fcs, FcChar32 ucs4);
310
311 FcChar32
312 FcCharSetCount (const FcCharSet *a);
313
314 FcChar32
315 FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
316
317 FcChar32
318 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
319
320 FcBool
321 FcCharSetIsSubset (const FcCharSet *a, const FcCharSet *b);
322
323 #define FC_CHARSET_MAP_SIZE (256/32)
324 #define FC_CHARSET_DONE ((FcChar32) -1)
325
326 FcChar32
327 FcCharSetFirstPage (const FcCharSet *a,
328 FcChar32 map[FC_CHARSET_MAP_SIZE],
329 FcChar32 *next);
330
331 FcChar32
332 FcCharSetNextPage (const FcCharSet *a,
333 FcChar32 map[FC_CHARSET_MAP_SIZE],
334 FcChar32 *next);
335
336
337 /* fcdbg.c */
338 void
339 FcValuePrint (FcValue v);
340
341 void
342 FcPatternPrint (FcPattern *p);
343
344 void
345 FcFontSetPrint (FcFontSet *s);
346
347 /* fcdefault.c */
348 void
349 FcDefaultSubstitute (FcPattern *pattern);
350
351 /* fcdir.c */
352 FcBool
353 FcFileScan (FcFontSet *set,
354 FcStrSet *dirs,
355 FcFileCache *cache,
356 FcBlanks *blanks,
357 const FcChar8 *file,
358 FcBool force);
359
360 FcBool
361 FcDirScan (FcFontSet *set,
362 FcStrSet *dirs,
363 FcFileCache *cache,
364 FcBlanks *blanks,
365 const FcChar8 *dir,
366 FcBool force);
367
368 FcBool
369 FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
370
371 /* fcfreetype.c */
372 FcPattern *
373 FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
374
375 /* fcfs.c */
376
377 FcFontSet *
378 FcFontSetCreate (void);
379
380 void
381 FcFontSetDestroy (FcFontSet *s);
382
383 FcBool
384 FcFontSetAdd (FcFontSet *s, FcPattern *font);
385
386 /* fcinit.c */
387 FcConfig *
388 FcInitLoadConfig (void);
389
390 FcConfig *
391 FcInitLoadConfigAndFonts (void);
392
393 FcBool
394 FcInit (void);
395
396 int
397 FcGetVersion (void);
398
399 FcBool
400 FcInitReinitialize (void);
401
402 FcBool
403 FcInitBringUptoDate (void);
404
405 /* fclist.c */
406 FcObjectSet *
407 FcObjectSetCreate (void);
408
409 FcBool
410 FcObjectSetAdd (FcObjectSet *os, const char *object);
411
412 void
413 FcObjectSetDestroy (FcObjectSet *os);
414
415 FcObjectSet *
416 FcObjectSetVaBuild (const char *first, va_list va);
417
418 FcObjectSet *
419 FcObjectSetBuild (const char *first, ...);
420
421 FcFontSet *
422 FcFontSetList (FcConfig *config,
423 FcFontSet **sets,
424 int nsets,
425 FcPattern *p,
426 FcObjectSet *os);
427
428 FcFontSet *
429 FcFontList (FcConfig *config,
430 FcPattern *p,
431 FcObjectSet *os);
432
433 /* fcatomic.c */
434
435 FcAtomic *
436 FcAtomicCreate (const FcChar8 *file);
437
438 FcBool
439 FcAtomicLock (FcAtomic *atomic);
440
441 FcChar8 *
442 FcAtomicNewFile (FcAtomic *atomic);
443
444 FcChar8 *
445 FcAtomicOrigFile (FcAtomic *atomic);
446
447 FcBool
448 FcAtomicReplaceOrig (FcAtomic *atomic);
449
450 void
451 FcAtomicDeleteNew (FcAtomic *atomic);
452
453 void
454 FcAtomicUnlock (FcAtomic *atomic);
455
456 void
457 FcAtomicDestroy (FcAtomic *atomic);
458
459 /* fcmatch.c */
460 FcPattern *
461 FcFontSetMatch (FcConfig *config,
462 FcFontSet **sets,
463 int nsets,
464 FcPattern *p,
465 FcResult *result);
466
467 FcPattern *
468 FcFontMatch (FcConfig *config,
469 FcPattern *p,
470 FcResult *result);
471
472 FcPattern *
473 FcFontRenderPrepare (FcConfig *config,
474 FcPattern *pat,
475 FcPattern *font);
476
477 FcFontSet *
478 FcFontSetSort (FcConfig *config,
479 FcFontSet **sets,
480 int nsets,
481 FcPattern *p,
482 FcBool trim,
483 FcCharSet **csp,
484 FcResult *result);
485
486 FcFontSet *
487 FcFontSort (FcConfig *config,
488 FcPattern *p,
489 FcBool trim,
490 FcCharSet **csp,
491 FcResult *result);
492
493 void
494 FcFontSetSortDestroy (FcFontSet *fs);
495
496 /* fcmatrix.c */
497 FcMatrix *
498 FcMatrixCopy (const FcMatrix *mat);
499
500 FcBool
501 FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2);
502
503 void
504 FcMatrixMultiply (FcMatrix *result, const FcMatrix *a, const FcMatrix *b);
505
506 void
507 FcMatrixRotate (FcMatrix *m, double c, double s);
508
509 void
510 FcMatrixScale (FcMatrix *m, double sx, double sy);
511
512 void
513 FcMatrixShear (FcMatrix *m, double sh, double sv);
514
515 /* fcname.c */
516
517 FcBool
518 FcNameRegisterObjectTypes (const FcObjectType *types, int ntype);
519
520 FcBool
521 FcNameUnregisterObjectTypes (const FcObjectType *types, int ntype);
522
523 const FcObjectType *
524 FcNameGetObjectType (const char *object);
525
526 FcBool
527 FcNameRegisterConstants (const FcConstant *consts, int nconsts);
528
529 FcBool
530 FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
531
532 const FcConstant *
533 FcNameGetConstant (FcChar8 *string);
534
535 FcBool
536 FcNameConstant (FcChar8 *string, int *result);
537
538 FcPattern *
539 FcNameParse (const FcChar8 *name);
540
541 FcChar8 *
542 FcNameUnparse (FcPattern *pat);
543
544 /* fcpat.c */
545 FcPattern *
546 FcPatternCreate (void);
547
548 FcPattern *
549 FcPatternDuplicate (FcPattern *p);
550
551 void
552 FcPatternReference (FcPattern *p);
553
554 void
555 FcValueDestroy (FcValue v);
556
557 FcBool
558 FcValueEqual (FcValue va, FcValue vb);
559
560 FcValue
561 FcValueSave (FcValue v);
562
563 void
564 FcPatternDestroy (FcPattern *p);
565
566 FcBool
567 FcPatternEqual (const FcPattern *pa, const FcPattern *pb);
568
569 FcBool
570 FcPatternEqualSubset (const FcPattern *pa, const FcPattern *pb, const FcObjectSet *os);
571
572 FcChar32
573 FcPatternHash (const FcPattern *p);
574
575 FcBool
576 FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append);
577
578 FcBool
579 FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append);
580
581 FcResult
582 FcPatternGet (FcPattern *p, const char *object, int id, FcValue *v);
583
584 FcBool
585 FcPatternDel (FcPattern *p, const char *object);
586
587 FcBool
588 FcPatternAddInteger (FcPattern *p, const char *object, int i);
589
590 FcBool
591 FcPatternAddDouble (FcPattern *p, const char *object, double d);
592
593 FcBool
594 FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
595
596 FcBool
597 FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
598
599 FcBool
600 FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c);
601
602 FcBool
603 FcPatternAddBool (FcPattern *p, const char *object, FcBool b);
604
605 FcResult
606 FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
607
608 FcResult
609 FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
610
611 FcResult
612 FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 ** s);
613
614 FcResult
615 FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
616
617 FcResult
618 FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
619
620 FcResult
621 FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
622
623 FcPattern *
624 FcPatternVaBuild (FcPattern *orig, va_list va);
625
626 FcPattern *
627 FcPatternBuild (FcPattern *orig, ...);
628
629 /* fcstr.c */
630
631 FcChar8 *
632 FcStrCopy (const FcChar8 *s);
633
634 FcChar8 *
635 FcStrCopyFilename (const FcChar8 *s);
636
637 #define FcToLower(c) (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
638
639 int
640 FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
641
642 int
643 FcStrCmp (const FcChar8 *s1, const FcChar8 *s2);
644
645 int
646 FcUtf8ToUcs4 (FcChar8 *src_orig,
647 FcChar32 *dst,
648 int len);
649
650 FcBool
651 FcUtf8Len (FcChar8 *string,
652 int len,
653 int *nchar,
654 int *wchar);
655
656 #define FC_UTF8_MAX_LEN 6
657
658 int
659 FcUcs4ToUtf8 (FcChar32 ucs4,
660 FcChar8 dest[FC_UTF8_MAX_LEN]);
661
662 int
663 FcUtf16ToUcs4 (FcChar8 *src_orig,
664 FcEndian endian,
665 FcChar32 *dst,
666 int len); /* in bytes */
667
668 FcBool
669 FcUtf16Len (FcChar8 *string,
670 FcEndian endian,
671 int len, /* in bytes */
672 int *nchar,
673 int *wchar);
674
675 FcChar8 *
676 FcStrDirname (const FcChar8 *file);
677
678 FcChar8 *
679 FcStrBasename (const FcChar8 *file);
680
681 FcStrSet *
682 FcStrSetCreate (void);
683
684 FcBool
685 FcStrSetMember (FcStrSet *set, const FcChar8 *s);
686
687 FcBool
688 FcStrSetAdd (FcStrSet *set, const FcChar8 *s);
689
690 FcBool
691 FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s);
692
693 FcBool
694 FcStrSetDel (FcStrSet *set, const FcChar8 *s);
695
696 void
697 FcStrSetDestroy (FcStrSet *set);
698
699 FcStrList *
700 FcStrListCreate (FcStrSet *set);
701
702 FcChar8 *
703 FcStrListNext (FcStrList *list);
704
705 void
706 FcStrListDone (FcStrList *list);
707
708 /* fcxml.c */
709 FcBool
710 FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
711
712 _FCFUNCPROTOEND
713
714 #endif /* _FONTCONFIG_H_ */