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