Xft.h revision 0d590c07
1/* include/X11/Xft/Xft.h.  Generated from Xft.h.in by configure.  */
2/*
3 * Copyright © 2000 Keith Packard
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission.  Keith Packard makes no
12 * representations about the suitability of this software for any purpose.  It
13 * is provided "as is" without express or implied warranty.
14 *
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
22 */
23
24#ifndef _XFT_H_
25#define _XFT_H_
26
27/*
28 * Current Xft version number, set from version in the Xft configure.ac file.
29 */
30
31#define XFT_MAJOR 2
32#define XFT_MINOR 1
33#define XFT_REVISION 14
34
35#define XFT_VERSION	((XFT_MAJOR * 10000) + (XFT_MINOR * 100) + (XFT_REVISION))
36#define XftVersion	XFT_VERSION
37
38#include <stdarg.h>
39#include <ft2build.h>
40#include FT_FREETYPE_H
41#include <fontconfig/fontconfig.h>
42#include <X11/extensions/Xrender.h>
43
44#include <X11/Xfuncproto.h>
45/* #include <X11/Xosdefs.h>*/
46#ifndef _X_SENTINEL
47# define _X_SENTINEL(x)
48#endif
49
50#ifndef _XFT_NO_COMPAT_
51#include <X11/Xft/XftCompat.h>
52#endif
53
54#define XFT_CORE		"core"
55#define XFT_RENDER		"render"
56#define XFT_XLFD		"xlfd"
57#define XFT_MAX_GLYPH_MEMORY	"maxglyphmemory"
58#define XFT_MAX_UNREF_FONTS	"maxunreffonts"
59
60extern FT_Library	_XftFTlibrary;
61
62typedef struct _XftFontInfo XftFontInfo;
63
64typedef struct _XftFont {
65    int		ascent;
66    int		descent;
67    int		height;
68    int		max_advance_width;
69    FcCharSet	*charset;
70    FcPattern	*pattern;
71} XftFont;
72
73typedef struct _XftDraw XftDraw;
74
75typedef struct _XftColor {
76    unsigned long   pixel;
77    XRenderColor    color;
78} XftColor;
79
80typedef struct _XftCharSpec {
81    FcChar32	    ucs4;
82    short	    x;
83    short	    y;
84} XftCharSpec;
85
86typedef struct _XftCharFontSpec {
87    XftFont	    *font;
88    FcChar32	    ucs4;
89    short	    x;
90    short	    y;
91} XftCharFontSpec;
92
93typedef struct _XftGlyphSpec {
94    FT_UInt	    glyph;
95    short	    x;
96    short	    y;
97} XftGlyphSpec;
98
99typedef struct _XftGlyphFontSpec {
100    XftFont	    *font;
101    FT_UInt	    glyph;
102    short	    x;
103    short	    y;
104} XftGlyphFontSpec;
105
106_XFUNCPROTOBEGIN
107
108
109/* xftcolor.c */
110Bool
111XftColorAllocName (Display  *dpy,
112		   _Xconst Visual   *visual,
113		   Colormap cmap,
114		   _Xconst char	    *name,
115		   XftColor *result);
116
117Bool
118XftColorAllocValue (Display	    *dpy,
119		    Visual	    *visual,
120		    Colormap	    cmap,
121		    _Xconst XRenderColor    *color,
122		    XftColor	    *result);
123
124void
125XftColorFree (Display	*dpy,
126	      Visual	*visual,
127	      Colormap	cmap,
128	      XftColor	*color);
129
130/* xftdpy.c */
131Bool
132XftDefaultHasRender (Display *dpy);
133
134Bool
135XftDefaultSet (Display *dpy, FcPattern *defaults);
136
137void
138XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern);
139
140/* xftdraw.c */
141
142XftDraw *
143XftDrawCreate (Display   *dpy,
144	       Drawable  drawable,
145	       Visual    *visual,
146	       Colormap  colormap);
147
148XftDraw *
149XftDrawCreateBitmap (Display  *dpy,
150		     Pixmap   bitmap);
151
152XftDraw *
153XftDrawCreateAlpha (Display *dpy,
154		    Pixmap  pixmap,
155		    int	    depth);
156
157void
158XftDrawChange (XftDraw	*draw,
159	       Drawable	drawable);
160
161Display *
162XftDrawDisplay (XftDraw *draw);
163
164Drawable
165XftDrawDrawable (XftDraw *draw);
166
167Colormap
168XftDrawColormap (XftDraw *draw);
169
170Visual *
171XftDrawVisual (XftDraw *draw);
172
173void
174XftDrawDestroy (XftDraw	*draw);
175
176Picture
177XftDrawPicture (XftDraw *draw);
178
179Picture
180XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color);
181
182void
183XftDrawGlyphs (XftDraw		*draw,
184	       _Xconst XftColor	*color,
185	       XftFont		*pub,
186	       int		x,
187	       int		y,
188	       _Xconst FT_UInt	*glyphs,
189	       int		nglyphs);
190
191void
192XftDrawString8 (XftDraw		    *draw,
193		_Xconst XftColor    *color,
194		XftFont		    *pub,
195		int		    x,
196		int		    y,
197		_Xconst FcChar8	    *string,
198		int		    len);
199
200void
201XftDrawString16 (XftDraw	    *draw,
202		 _Xconst XftColor   *color,
203		 XftFont	    *pub,
204		 int		    x,
205		 int		    y,
206		 _Xconst FcChar16   *string,
207		 int		    len);
208
209void
210XftDrawString32 (XftDraw	    *draw,
211		 _Xconst XftColor   *color,
212		 XftFont	    *pub,
213		 int		    x,
214		 int		    y,
215		 _Xconst FcChar32   *string,
216		 int		    len);
217
218void
219XftDrawStringUtf8 (XftDraw	    *draw,
220		   _Xconst XftColor *color,
221		   XftFont	    *pub,
222		   int		    x,
223		   int		    y,
224		   _Xconst FcChar8  *string,
225		   int		    len);
226
227void
228XftDrawStringUtf16 (XftDraw		*draw,
229		    _Xconst XftColor	*color,
230		    XftFont		*pub,
231		    int			x,
232		    int			y,
233		    _Xconst FcChar8	*string,
234		    FcEndian		endian,
235		    int			len);
236
237void
238XftDrawCharSpec (XftDraw		*draw,
239		 _Xconst XftColor	*color,
240		 XftFont		*pub,
241		 _Xconst XftCharSpec	*chars,
242		 int			len);
243
244void
245XftDrawCharFontSpec (XftDraw			*draw,
246		     _Xconst XftColor		*color,
247		     _Xconst XftCharFontSpec	*chars,
248		     int			len);
249
250void
251XftDrawGlyphSpec (XftDraw		*draw,
252		  _Xconst XftColor	*color,
253		  XftFont		*pub,
254		  _Xconst XftGlyphSpec	*glyphs,
255		  int			len);
256
257void
258XftDrawGlyphFontSpec (XftDraw			*draw,
259		      _Xconst XftColor		*color,
260		      _Xconst XftGlyphFontSpec	*glyphs,
261		      int			len);
262
263void
264XftDrawRect (XftDraw		*draw,
265	     _Xconst XftColor	*color,
266	     int		x,
267	     int		y,
268	     unsigned int	width,
269	     unsigned int	height);
270
271
272Bool
273XftDrawSetClip (XftDraw	    *draw,
274		Region	    r);
275
276
277Bool
278XftDrawSetClipRectangles (XftDraw		*draw,
279			  int			xOrigin,
280			  int			yOrigin,
281			  _Xconst XRectangle	*rects,
282			  int			n);
283
284void
285XftDrawSetSubwindowMode (XftDraw    *draw,
286			 int	    mode);
287
288/* xftextent.c */
289
290void
291XftGlyphExtents (Display	    *dpy,
292		 XftFont	    *pub,
293		 _Xconst FT_UInt    *glyphs,
294		 int		    nglyphs,
295		 XGlyphInfo	    *extents);
296
297void
298XftTextExtents8 (Display	    *dpy,
299		 XftFont	    *pub,
300		 _Xconst FcChar8    *string,
301		 int		    len,
302		 XGlyphInfo	    *extents);
303
304void
305XftTextExtents16 (Display	    *dpy,
306		  XftFont	    *pub,
307		  _Xconst FcChar16  *string,
308		  int		    len,
309		  XGlyphInfo	    *extents);
310
311void
312XftTextExtents32 (Display	    *dpy,
313		  XftFont	    *pub,
314		  _Xconst FcChar32  *string,
315		  int		    len,
316		  XGlyphInfo	    *extents);
317
318void
319XftTextExtentsUtf8 (Display	    *dpy,
320		    XftFont	    *pub,
321		    _Xconst FcChar8 *string,
322		    int		    len,
323		    XGlyphInfo	    *extents);
324
325void
326XftTextExtentsUtf16 (Display		*dpy,
327		     XftFont		*pub,
328		     _Xconst FcChar8	*string,
329		     FcEndian		endian,
330		     int		len,
331		     XGlyphInfo		*extents);
332
333/* xftfont.c */
334FcPattern *
335XftFontMatch (Display		*dpy,
336	      int		screen,
337	      _Xconst FcPattern *pattern,
338	      FcResult		*result);
339
340XftFont *
341XftFontOpen (Display *dpy, int screen, ...) _X_SENTINEL(0);
342
343XftFont *
344XftFontOpenName (Display *dpy, int screen, _Xconst char *name);
345
346XftFont *
347XftFontOpenXlfd (Display *dpy, int screen, _Xconst char *xlfd);
348
349/* xftfreetype.c */
350
351FT_Face
352XftLockFace (XftFont *pub);
353
354void
355XftUnlockFace (XftFont *pub);
356
357XftFontInfo *
358XftFontInfoCreate (Display *dpy, _Xconst FcPattern *pattern);
359
360void
361XftFontInfoDestroy (Display *dpy, XftFontInfo *fi);
362
363FcChar32
364XftFontInfoHash (_Xconst XftFontInfo *fi);
365
366FcBool
367XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b);
368
369XftFont *
370XftFontOpenInfo (Display	*dpy,
371		 FcPattern	*pattern,
372		 XftFontInfo	*fi);
373
374XftFont *
375XftFontOpenPattern (Display *dpy, FcPattern *pattern);
376
377XftFont *
378XftFontCopy (Display *dpy, XftFont *pub);
379
380void
381XftFontClose (Display *dpy, XftFont *pub);
382
383FcBool
384XftInitFtLibrary(void);
385
386/* xftglyphs.c */
387void
388XftFontLoadGlyphs (Display	    *dpy,
389		   XftFont	    *pub,
390		   FcBool	    need_bitmaps,
391		   _Xconst FT_UInt  *glyphs,
392		   int		    nglyph);
393
394void
395XftFontUnloadGlyphs (Display		*dpy,
396		     XftFont		*pub,
397		     _Xconst FT_UInt	*glyphs,
398		     int		nglyph);
399
400#define XFT_NMISSING		256
401
402FcBool
403XftFontCheckGlyph (Display  *dpy,
404		   XftFont  *pub,
405		   FcBool   need_bitmaps,
406		   FT_UInt  glyph,
407		   FT_UInt  *missing,
408		   int	    *nmissing);
409
410FcBool
411XftCharExists (Display	    *dpy,
412	       XftFont	    *pub,
413	       FcChar32    ucs4);
414
415FT_UInt
416XftCharIndex (Display	    *dpy,
417	      XftFont	    *pub,
418	      FcChar32	    ucs4);
419
420/* xftinit.c */
421FcBool
422XftInit (_Xconst char *config);
423
424int
425XftGetVersion (void);
426
427/* xftlist.c */
428
429FcFontSet *
430XftListFonts (Display	*dpy,
431	      int	screen,
432	      ...) _X_SENTINEL(0);
433
434/* xftname.c */
435FcPattern
436*XftNameParse (_Xconst char *name);
437
438/* xftrender.c */
439void
440XftGlyphRender (Display		*dpy,
441		int		op,
442		Picture		src,
443		XftFont		*pub,
444		Picture		dst,
445		int		srcx,
446		int		srcy,
447		int		x,
448		int		y,
449		_Xconst FT_UInt	*glyphs,
450		int		nglyphs);
451
452void
453XftGlyphSpecRender (Display		    *dpy,
454		    int			    op,
455		    Picture		    src,
456		    XftFont		    *pub,
457		    Picture		    dst,
458		    int			    srcx,
459		    int			    srcy,
460		    _Xconst XftGlyphSpec    *glyphs,
461		    int			    nglyphs);
462
463void
464XftCharSpecRender (Display		*dpy,
465		   int			op,
466		   Picture		src,
467		   XftFont		*pub,
468		   Picture		dst,
469		   int			srcx,
470		   int			srcy,
471		   _Xconst XftCharSpec	*chars,
472		   int			len);
473
474void
475XftGlyphFontSpecRender (Display			    *dpy,
476			int			    op,
477			Picture			    src,
478			Picture			    dst,
479			int			    srcx,
480			int			    srcy,
481			_Xconst XftGlyphFontSpec    *glyphs,
482			int			    nglyphs);
483
484void
485XftCharFontSpecRender (Display			*dpy,
486		       int			op,
487		       Picture			src,
488		       Picture			dst,
489		       int			srcx,
490		       int			srcy,
491		       _Xconst XftCharFontSpec	*chars,
492		       int			len);
493
494void
495XftTextRender8 (Display		*dpy,
496		int		op,
497		Picture		src,
498		XftFont		*pub,
499		Picture		dst,
500		int		srcx,
501		int		srcy,
502		int		x,
503		int		y,
504		_Xconst FcChar8	*string,
505		int		len);
506
507void
508XftTextRender16 (Display	    *dpy,
509		 int		    op,
510		 Picture	    src,
511		 XftFont	    *pub,
512		 Picture	    dst,
513		 int		    srcx,
514		 int		    srcy,
515		 int		    x,
516		 int		    y,
517		 _Xconst FcChar16   *string,
518		 int		    len);
519
520void
521XftTextRender16BE (Display	    *dpy,
522		   int		    op,
523		   Picture	    src,
524		   XftFont	    *pub,
525		   Picture	    dst,
526		   int		    srcx,
527		   int		    srcy,
528		   int		    x,
529		   int		    y,
530		   _Xconst FcChar8  *string,
531		   int		    len);
532
533void
534XftTextRender16LE (Display	    *dpy,
535		   int		    op,
536		   Picture	    src,
537		   XftFont	    *pub,
538		   Picture	    dst,
539		   int		    srcx,
540		   int		    srcy,
541		   int		    x,
542		   int		    y,
543		   _Xconst FcChar8  *string,
544		   int		    len);
545
546void
547XftTextRender32 (Display	    *dpy,
548		 int		    op,
549		 Picture	    src,
550		 XftFont	    *pub,
551		 Picture	    dst,
552		 int		    srcx,
553		 int		    srcy,
554		 int		    x,
555		 int		    y,
556		 _Xconst FcChar32   *string,
557		 int		    len);
558
559void
560XftTextRender32BE (Display	    *dpy,
561		   int		    op,
562		   Picture	    src,
563		   XftFont	    *pub,
564		   Picture	    dst,
565		   int		    srcx,
566		   int		    srcy,
567		   int		    x,
568		   int		    y,
569		   _Xconst FcChar8  *string,
570		   int		    len);
571
572void
573XftTextRender32LE (Display	    *dpy,
574		   int		    op,
575		   Picture	    src,
576		   XftFont	    *pub,
577		   Picture	    dst,
578		   int		    srcx,
579		   int		    srcy,
580		   int		    x,
581		   int		    y,
582		   _Xconst FcChar8  *string,
583		   int		    len);
584
585void
586XftTextRenderUtf8 (Display	    *dpy,
587		   int		    op,
588		   Picture	    src,
589		   XftFont	    *pub,
590		   Picture	    dst,
591		   int		    srcx,
592		   int		    srcy,
593		   int		    x,
594		   int		    y,
595		   _Xconst FcChar8  *string,
596		   int		    len);
597
598void
599XftTextRenderUtf16 (Display	    *dpy,
600		    int		    op,
601		    Picture	    src,
602		    XftFont	    *pub,
603		    Picture	    dst,
604		    int		    srcx,
605		    int		    srcy,
606		    int		    x,
607		    int		    y,
608		    _Xconst FcChar8 *string,
609		    FcEndian	    endian,
610		    int		    len);
611
612/* xftxlfd.c */
613FcPattern *
614XftXlfdParse (_Xconst char *xlfd_orig, Bool ignore_scalable, Bool complete);
615
616_XFUNCPROTOEND
617
618#endif /* _XFT_H_ */
619