Home | History | Annotate | Line # | Download | only in Xft
      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 
     58 extern FT_Library	_XftFTlibrary;
     59 
     60 typedef struct _XftFontInfo XftFontInfo;
     61 
     62 typedef 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 
     71 typedef struct _XftDraw XftDraw;
     72 
     73 typedef struct _XftColor {
     74     unsigned long   pixel;
     75     XRenderColor    color;
     76 } XftColor;
     77 
     78 typedef struct _XftCharSpec {
     79     FcChar32	    ucs4;
     80     short	    x;
     81     short	    y;
     82 } XftCharSpec;
     83 
     84 typedef struct _XftCharFontSpec {
     85     XftFont	    *font;
     86     FcChar32	    ucs4;
     87     short	    x;
     88     short	    y;
     89 } XftCharFontSpec;
     90 
     91 typedef struct _XftGlyphSpec {
     92     FT_UInt	    glyph;
     93     short	    x;
     94     short	    y;
     95 } XftGlyphSpec;
     96 
     97 typedef 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 */
    108 Bool
    109 XftColorAllocName (Display  *dpy,
    110 		   _Xconst Visual   *visual,
    111 		   Colormap cmap,
    112 		   _Xconst char	    *name,
    113 		   XftColor *result);
    114 
    115 Bool
    116 XftColorAllocValue (Display	    *dpy,
    117 		    Visual	    *visual,
    118 		    Colormap	    cmap,
    119 		    _Xconst XRenderColor    *color,
    120 		    XftColor	    *result);
    121 
    122 void
    123 XftColorFree (Display	*dpy,
    124 	      Visual	*visual,
    125 	      Colormap	cmap,
    126 	      XftColor	*color);
    127 
    128 /* xftdpy.c */
    129 Bool
    130 XftDefaultHasRender (Display *dpy);
    131 
    132 Bool
    133 XftDefaultSet (Display *dpy, FcPattern *defaults);
    134 
    135 void
    136 XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern);
    137 
    138 /* xftdraw.c */
    139 
    140 XftDraw *
    141 XftDrawCreate (Display   *dpy,
    142 	       Drawable  drawable,
    143 	       Visual    *visual,
    144 	       Colormap  colormap);
    145 
    146 XftDraw *
    147 XftDrawCreateBitmap (Display  *dpy,
    148 		     Pixmap   bitmap);
    149 
    150 XftDraw *
    151 XftDrawCreateAlpha (Display *dpy,
    152 		    Pixmap  pixmap,
    153 		    int	    depth);
    154 
    155 void
    156 XftDrawChange (XftDraw	*draw,
    157 	       Drawable	drawable);
    158 
    159 Display *
    160 XftDrawDisplay (XftDraw *draw);
    161 
    162 Drawable
    163 XftDrawDrawable (XftDraw *draw);
    164 
    165 Colormap
    166 XftDrawColormap (XftDraw *draw);
    167 
    168 Visual *
    169 XftDrawVisual (XftDraw *draw);
    170 
    171 void
    172 XftDrawDestroy (XftDraw	*draw);
    173 
    174 Picture
    175 XftDrawPicture (XftDraw *draw);
    176 
    177 Picture
    178 XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color);
    179 
    180 void
    181 XftDrawGlyphs (XftDraw		*draw,
    182 	       _Xconst XftColor	*color,
    183 	       XftFont		*pub,
    184 	       int		x,
    185 	       int		y,
    186 	       _Xconst FT_UInt	*glyphs,
    187 	       int		nglyphs);
    188 
    189 void
    190 XftDrawString8 (XftDraw		    *draw,
    191 		_Xconst XftColor    *color,
    192 		XftFont		    *pub,
    193 		int		    x,
    194 		int		    y,
    195 		_Xconst FcChar8	    *string,
    196 		int		    len);
    197 
    198 void
    199 XftDrawString16 (XftDraw	    *draw,
    200 		 _Xconst XftColor   *color,
    201 		 XftFont	    *pub,
    202 		 int		    x,
    203 		 int		    y,
    204 		 _Xconst FcChar16   *string,
    205 		 int		    len);
    206 
    207 void
    208 XftDrawString32 (XftDraw	    *draw,
    209 		 _Xconst XftColor   *color,
    210 		 XftFont	    *pub,
    211 		 int		    x,
    212 		 int		    y,
    213 		 _Xconst FcChar32   *string,
    214 		 int		    len);
    215 
    216 void
    217 XftDrawStringUtf8 (XftDraw	    *draw,
    218 		   _Xconst XftColor *color,
    219 		   XftFont	    *pub,
    220 		   int		    x,
    221 		   int		    y,
    222 		   _Xconst FcChar8  *string,
    223 		   int		    len);
    224 
    225 void
    226 XftDrawStringUtf16 (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 
    235 void
    236 XftDrawCharSpec (XftDraw		*draw,
    237 		 _Xconst XftColor	*color,
    238 		 XftFont		*pub,
    239 		 _Xconst XftCharSpec	*chars,
    240 		 int			len);
    241 
    242 void
    243 XftDrawCharFontSpec (XftDraw			*draw,
    244 		     _Xconst XftColor		*color,
    245 		     _Xconst XftCharFontSpec	*chars,
    246 		     int			len);
    247 
    248 void
    249 XftDrawGlyphSpec (XftDraw		*draw,
    250 		  _Xconst XftColor	*color,
    251 		  XftFont		*pub,
    252 		  _Xconst XftGlyphSpec	*glyphs,
    253 		  int			len);
    254 
    255 void
    256 XftDrawGlyphFontSpec (XftDraw			*draw,
    257 		      _Xconst XftColor		*color,
    258 		      _Xconst XftGlyphFontSpec	*glyphs,
    259 		      int			len);
    260 
    261 void
    262 XftDrawRect (XftDraw		*draw,
    263 	     _Xconst XftColor	*color,
    264 	     int		x,
    265 	     int		y,
    266 	     unsigned int	width,
    267 	     unsigned int	height);
    268 
    269 
    270 Bool
    271 XftDrawSetClip (XftDraw	    *draw,
    272 		Region	    r);
    273 
    274 
    275 Bool
    276 XftDrawSetClipRectangles (XftDraw		*draw,
    277 			  int			xOrigin,
    278 			  int			yOrigin,
    279 			  _Xconst XRectangle	*rects,
    280 			  int			n);
    281 
    282 void
    283 XftDrawSetSubwindowMode (XftDraw    *draw,
    284 			 int	    mode);
    285 
    286 /* xftextent.c */
    287 
    288 void
    289 XftGlyphExtents (Display	    *dpy,
    290 		 XftFont	    *pub,
    291 		 _Xconst FT_UInt    *glyphs,
    292 		 int		    nglyphs,
    293 		 XGlyphInfo	    *extents);
    294 
    295 void
    296 XftTextExtents8 (Display	    *dpy,
    297 		 XftFont	    *pub,
    298 		 _Xconst FcChar8    *string,
    299 		 int		    len,
    300 		 XGlyphInfo	    *extents);
    301 
    302 void
    303 XftTextExtents16 (Display	    *dpy,
    304 		  XftFont	    *pub,
    305 		  _Xconst FcChar16  *string,
    306 		  int		    len,
    307 		  XGlyphInfo	    *extents);
    308 
    309 void
    310 XftTextExtents32 (Display	    *dpy,
    311 		  XftFont	    *pub,
    312 		  _Xconst FcChar32  *string,
    313 		  int		    len,
    314 		  XGlyphInfo	    *extents);
    315 
    316 void
    317 XftTextExtentsUtf8 (Display	    *dpy,
    318 		    XftFont	    *pub,
    319 		    _Xconst FcChar8 *string,
    320 		    int		    len,
    321 		    XGlyphInfo	    *extents);
    322 
    323 void
    324 XftTextExtentsUtf16 (Display		*dpy,
    325 		     XftFont		*pub,
    326 		     _Xconst FcChar8	*string,
    327 		     FcEndian		endian,
    328 		     int		len,
    329 		     XGlyphInfo		*extents);
    330 
    331 /* xftfont.c */
    332 FcPattern *
    333 XftFontMatch (Display		*dpy,
    334 	      int		screen,
    335 	      _Xconst FcPattern *pattern,
    336 	      FcResult		*result);
    337 
    338 XftFont *
    339 XftFontOpen (Display *dpy, int screen, ...) _X_SENTINEL(0);
    340 
    341 XftFont *
    342 XftFontOpenName (Display *dpy, int screen, _Xconst char *name);
    343 
    344 XftFont *
    345 XftFontOpenXlfd (Display *dpy, int screen, _Xconst char *xlfd);
    346 
    347 /* xftfreetype.c */
    348 
    349 FT_Face
    350 XftLockFace (XftFont *pub);
    351 
    352 void
    353 XftUnlockFace (XftFont *pub);
    354 
    355 XftFontInfo *
    356 XftFontInfoCreate (Display *dpy, _Xconst FcPattern *pattern);
    357 
    358 void
    359 XftFontInfoDestroy (Display *dpy, XftFontInfo *fi);
    360 
    361 FcChar32
    362 XftFontInfoHash (_Xconst XftFontInfo *fi);
    363 
    364 FcBool
    365 XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b);
    366 
    367 XftFont *
    368 XftFontOpenInfo (Display	*dpy,
    369 		 FcPattern	*pattern,
    370 		 XftFontInfo	*fi);
    371 
    372 XftFont *
    373 XftFontOpenPattern (Display *dpy, FcPattern *pattern);
    374 
    375 XftFont *
    376 XftFontCopy (Display *dpy, XftFont *pub);
    377 
    378 void
    379 XftFontClose (Display *dpy, XftFont *pub);
    380 
    381 FcBool
    382 XftInitFtLibrary(void);
    383 
    384 /* xftglyphs.c */
    385 void
    386 XftFontLoadGlyphs (Display	    *dpy,
    387 		   XftFont	    *pub,
    388 		   FcBool	    need_bitmaps,
    389 		   _Xconst FT_UInt  *glyphs,
    390 		   int		    nglyph);
    391 
    392 void
    393 XftFontUnloadGlyphs (Display		*dpy,
    394 		     XftFont		*pub,
    395 		     _Xconst FT_UInt	*glyphs,
    396 		     int		nglyph);
    397 
    398 #define XFT_NMISSING		256
    399 
    400 FcBool
    401 XftFontCheckGlyph (Display  *dpy,
    402 		   XftFont  *pub,
    403 		   FcBool   need_bitmaps,
    404 		   FT_UInt  glyph,
    405 		   FT_UInt  *missing,
    406 		   int	    *nmissing);
    407 
    408 FcBool
    409 XftCharExists (Display	    *dpy,
    410 	       XftFont	    *pub,
    411 	       FcChar32    ucs4);
    412 
    413 FT_UInt
    414 XftCharIndex (Display	    *dpy,
    415 	      XftFont	    *pub,
    416 	      FcChar32	    ucs4);
    417 
    418 /* xftinit.c */
    419 FcBool
    420 XftInit (_Xconst char *config);
    421 
    422 int
    423 XftGetVersion (void);
    424 
    425 /* xftlist.c */
    426 
    427 FcFontSet *
    428 XftListFonts (Display	*dpy,
    429 	      int	screen,
    430 	      ...) _X_SENTINEL(0);
    431 
    432 /* xftname.c */
    433 FcPattern
    434 *XftNameParse (_Xconst char *name);
    435 
    436 FcBool
    437 XftNameUnparse (FcPattern *pat, char *dest, int len);
    438 
    439 /* xftrender.c */
    440 void
    441 XftGlyphRender (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 
    453 void
    454 XftGlyphSpecRender (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 
    464 void
    465 XftCharSpecRender (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 
    475 void
    476 XftGlyphFontSpecRender (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 
    485 void
    486 XftCharFontSpecRender (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 
    495 void
    496 XftTextRender8 (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 
    508 void
    509 XftTextRender16 (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 
    521 void
    522 XftTextRender16BE (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 
    534 void
    535 XftTextRender16LE (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 
    547 void
    548 XftTextRender32 (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 
    560 void
    561 XftTextRender32BE (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 
    573 void
    574 XftTextRender32LE (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 
    586 void
    587 XftTextRenderUtf8 (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 
    599 void
    600 XftTextRenderUtf16 (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 */
    614 FcPattern *
    615 XftXlfdParse (_Xconst char *xlfd_orig, Bool ignore_scalable, Bool complete);
    616 
    617 _XFUNCPROTOEND
    618 
    619 #endif /* _XFT_H_ */
    620