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