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