Changeset 4143 for libcaca/trunk/caca/driver/x11.c
- Timestamp:
- Dec 18, 2009, 10:17:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver/x11.c
r4142 r4143 210 210 if (dp->drv.p->font_set) 211 211 { 212 XFontSetExtents *ex = XExtentsOfFontSet(dp->drv.p->font_set); 212 /* Do not trust the fontset, because some fonts may have 213 * irrelevantly large glyphs. Pango and rxvt use the same method. */ 214 static wchar_t const test[] = 215 { 216 '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_', 217 0x00cd, 0x00e7, 0x00d5, 0x0114, 0x0177, /* Í ç Õ Ĕ ŷ */ 218 /* 0x0643, */ /* ﻙ */ 219 0x304c, 0x672c, /* が本 */ 220 0, 221 }; 222 223 XRectangle ink, logical; 224 213 225 dp->drv.p->font_width = 214 XmbTextEscapement(dp->drv.p->font_set, "CAca", 4) / 4; 215 dp->drv.p->font_height = ex->max_logical_extent.height; 216 dp->drv.p->font_offset = ex->max_logical_extent.height 217 + ex->max_logical_extent.y; 226 (XmbTextEscapement(dp->drv.p->font_set, "CAca", 4) + 2) / 4; 227 XwcTextExtents(dp->drv.p->font_set, test, sizeof(test) / sizeof(*test), 228 &ink, &logical); 229 dp->drv.p->font_height = ink.height; 230 dp->drv.p->font_offset = ink.height + ink.y; 218 231 } 219 232 else … … 902 915 { 903 916 wchar_t wch = ch; 904 XwcDrawString(dpy, px, dp->drv.p->font_set, gc, 905 x + (fw - w) / 2, yoff, &wch, 1); 917 XwcDrawString(dpy, px, dp->drv.p->font_set, gc, x, yoff, &wch, 1); 906 918 } 907 919 else … … 923 935 } 924 936 925 XDrawString16(dpy, px, gc, 926 x + (ch16.byte1 ? 0 : (fw - w) / 2), yoff, &ch16, 1); 937 XDrawString16(dpy, px, gc, x, yoff, &ch16, 1); 927 938 } 928 939 }
Note: See TracChangeset
for help on using the changeset viewer.