… | |
… | |
158 | 0x304c, 0x672c, // が本 |
158 | 0x304c, 0x672c, // が本 |
159 | }; |
159 | }; |
160 | |
160 | |
161 | #define NUM_EXTENT_TEST_CHARS (sizeof (extent_test_chars) / sizeof (extent_test_chars[0])) |
161 | #define NUM_EXTENT_TEST_CHARS (sizeof (extent_test_chars) / sizeof (extent_test_chars[0])) |
162 | |
162 | |
163 | #define dTermDisplay Display *disp = term->xdisp |
163 | #define dTermDisplay Display *disp = term->dpy |
164 | #define dTermGC GC gc = term->gc |
164 | #define dTermGC GC gc = term->gc |
165 | |
165 | |
166 | ///////////////////////////////////////////////////////////////////////////// |
166 | ///////////////////////////////////////////////////////////////////////////// |
167 | |
167 | |
168 | #if XFT |
168 | #if XFT |
… | |
… | |
173 | } |
173 | } |
174 | |
174 | |
175 | rxvt_drawable::operator XftDraw *() |
175 | rxvt_drawable::operator XftDraw *() |
176 | { |
176 | { |
177 | if (!xftdrawable) |
177 | if (!xftdrawable) |
178 | xftdrawable = XftDrawCreate (screen->xdisp, drawable, screen->visual, screen->cmap); |
178 | xftdrawable = XftDrawCreate (screen->dpy, drawable, screen->visual, screen->cmap); |
179 | |
179 | |
180 | return xftdrawable; |
180 | return xftdrawable; |
181 | } |
181 | } |
182 | #endif |
182 | #endif |
183 | |
183 | |
… | |
… | |
514 | rxvt_font_x11::get_property (XFontStruct *f, Atom property, const char *repl) const |
514 | rxvt_font_x11::get_property (XFontStruct *f, Atom property, const char *repl) const |
515 | { |
515 | { |
516 | unsigned long value; |
516 | unsigned long value; |
517 | |
517 | |
518 | if (XGetFontProperty (f, property, &value)) |
518 | if (XGetFontProperty (f, property, &value)) |
519 | return XGetAtomName (term->xdisp, value); |
519 | return XGetAtomName (term->dpy, value); |
520 | else |
520 | else |
521 | return rxvt_strdup (repl); |
521 | return rxvt_strdup (repl); |
522 | } |
522 | } |
523 | |
523 | |
524 | rxvt_fontprop |
524 | rxvt_fontprop |
… | |
… | |
547 | rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f) |
547 | rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f) |
548 | { |
548 | { |
549 | unsigned long height; |
549 | unsigned long height; |
550 | |
550 | |
551 | #if 0 |
551 | #if 0 |
552 | if (!XGetFontProperty (f, XInternAtom (term->xdisp, "PIXEL_SIZE", 0), &height)) |
552 | if (!XGetFontProperty (f, XInternAtom (term->dpy, "PIXEL_SIZE", 0), &height)) |
553 | return false; |
553 | return false; |
554 | #else |
554 | #else |
555 | height = f->ascent + f->descent; |
555 | height = f->ascent + f->descent; |
556 | #endif |
556 | #endif |
557 | |
557 | |
… | |
… | |
892 | void |
892 | void |
893 | rxvt_font_x11::clear () |
893 | rxvt_font_x11::clear () |
894 | { |
894 | { |
895 | if (f) |
895 | if (f) |
896 | { |
896 | { |
897 | XFreeFont (term->xdisp, f); |
897 | XFreeFont (term->dpy, f); |
898 | f = 0; |
898 | f = 0; |
899 | } |
899 | } |
900 | } |
900 | } |
901 | |
901 | |
902 | bool |
902 | bool |
… | |
… | |
1074 | void |
1074 | void |
1075 | rxvt_font_xft::clear () |
1075 | rxvt_font_xft::clear () |
1076 | { |
1076 | { |
1077 | if (f) |
1077 | if (f) |
1078 | { |
1078 | { |
1079 | XftFontClose (term->xdisp, f); |
1079 | XftFontClose (term->dpy, f); |
1080 | f = 0; |
1080 | f = 0; |
1081 | } |
1081 | } |
1082 | } |
1082 | } |
1083 | |
1083 | |
1084 | rxvt_fontprop |
1084 | rxvt_fontprop |
… | |
… | |
1251 | bool |
1251 | bool |
1252 | rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const |
1252 | rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const |
1253 | { |
1253 | { |
1254 | careful = false; |
1254 | careful = false; |
1255 | |
1255 | |
1256 | if (!XftCharExists (term->xdisp, f, unicode)) |
1256 | if (!XftCharExists (term->dpy, f, unicode)) |
1257 | return false; |
1257 | return false; |
1258 | |
1258 | |
1259 | if (!prop || prop->width == rxvt_fontprop::unset) |
1259 | if (!prop || prop->width == rxvt_fontprop::unset) |
1260 | return true; |
1260 | return true; |
1261 | |
1261 | |
1262 | // check character against base font bounding box |
1262 | // check character against base font bounding box |
1263 | FcChar32 ch = unicode; |
1263 | FcChar32 ch = unicode; |
1264 | XGlyphInfo g; |
1264 | XGlyphInfo g; |
1265 | XftTextExtents32 (term->xdisp, f, &ch, 1, &g); |
1265 | XftTextExtents32 (term->dpy, f, &ch, 1, &g); |
1266 | |
1266 | |
1267 | int w = g.width - g.x; |
1267 | int w = g.width - g.x; |
1268 | int wcw = max (WCWIDTH (unicode), 1); |
1268 | int wcw = max (WCWIDTH (unicode), 1); |
1269 | |
1269 | |
1270 | careful = g.x > 0 || w > prop->width * wcw; |
1270 | careful = g.x > 0 || w > prop->width * wcw; |
… | |
… | |
1307 | |
1307 | |
1308 | if (fc != ' ') // skip spaces |
1308 | if (fc != ' ') // skip spaces |
1309 | { |
1309 | { |
1310 | FT_UInt glyph = XftCharIndex (disp, f, fc); |
1310 | FT_UInt glyph = XftCharIndex (disp, f, fc); |
1311 | XftGlyphExtents (disp, f, &glyph, 1, &extents); |
1311 | XftGlyphExtents (disp, f, &glyph, 1, &extents); |
1312 | |
|
|
1313 | |
1312 | |
1314 | ep->glyph = glyph; |
1313 | ep->glyph = glyph; |
1315 | ep->x = x + (cwidth - extents.xOff >> 1); |
1314 | ep->x = x + (cwidth - extents.xOff >> 1); |
1316 | ep->y = y + ascent; |
1315 | ep->y = y + ascent; |
1317 | |
1316 | |
… | |
… | |
1577 | FcPatternAddInteger (p, FC_SLANT, prop.slant); |
1576 | FcPatternAddInteger (p, FC_SLANT, prop.slant); |
1578 | FcPatternAddBool (p, FC_MINSPACE, 1); |
1577 | FcPatternAddBool (p, FC_MINSPACE, 1); |
1579 | //FcPatternAddBool (p, FC_ANTIALIAS, 1); |
1578 | //FcPatternAddBool (p, FC_ANTIALIAS, 1); |
1580 | |
1579 | |
1581 | XftResult result; |
1580 | XftResult result; |
1582 | FcPattern *match = XftFontMatch (term->xdisp, term->display->screen, p, &result); |
1581 | FcPattern *match = XftFontMatch (term->dpy, term->display->screen, p, &result); |
1583 | |
1582 | |
1584 | FcPatternDestroy (p); |
1583 | FcPatternDestroy (p); |
1585 | |
1584 | |
1586 | if (match) |
1585 | if (match) |
1587 | { |
1586 | { |