ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtfont.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtfont.C (file contents):
Revision 1.87 by root, Wed Jan 25 21:03:04 2006 UTC vs.
Revision 1.88 by root, Wed Jan 25 21:09:21 2006 UTC

157 0x304c, 0x672c, // が本 157 0x304c, 0x672c, // が本
158}; 158};
159 159
160#define NUM_EXTENT_TEST_CHARS (sizeof (extent_test_chars) / sizeof (extent_test_chars[0])) 160#define NUM_EXTENT_TEST_CHARS (sizeof (extent_test_chars) / sizeof (extent_test_chars[0]))
161 161
162#define dTermDisplay Display *disp = term->display->display 162#define dTermDisplay Display *disp = term->xdisp
163#define dTermGC GC gc = term->gc 163#define dTermGC GC gc = term->gc
164 164
165///////////////////////////////////////////////////////////////////////////// 165/////////////////////////////////////////////////////////////////////////////
166 166
167#if XFT 167#if XFT
504char * 504char *
505rxvt_font_x11::get_property (XFontStruct *f, const char *property, const char *repl) const 505rxvt_font_x11::get_property (XFontStruct *f, const char *property, const char *repl) const
506{ 506{
507 unsigned long value; 507 unsigned long value;
508 508
509 if (XGetFontProperty (f, XInternAtom (term->display->display, property, 0), &value)) 509 if (XGetFontProperty (f, XInternAtom (term->xdisp, property, 0), &value))
510 return XGetAtomName (term->display->display, value); 510 return XGetAtomName (term->xdisp, value);
511 else 511 else
512 return rxvt_strdup (repl); 512 return rxvt_strdup (repl);
513} 513}
514 514
515rxvt_fontprop 515rxvt_fontprop
536rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f) 536rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f)
537{ 537{
538 unsigned long height; 538 unsigned long height;
539 539
540#if 0 540#if 0
541 if (!XGetFontProperty (f, XInternAtom (term->display->display, "PIXEL_SIZE", 0), &height)) 541 if (!XGetFontProperty (f, XInternAtom (term->xdisp, "PIXEL_SIZE", 0), &height))
542 return false; 542 return false;
543#else 543#else
544 height = f->ascent + f->descent; 544 height = f->ascent + f->descent;
545#endif 545#endif
546 546
547 unsigned long avgwidth; 547 unsigned long avgwidth;
548 if (!XGetFontProperty (f, XInternAtom (term->display->display, "AVERAGE_WIDTH", 0), &avgwidth)) 548 if (!XGetFontProperty (f, XInternAtom (term->xdisp, "AVERAGE_WIDTH", 0), &avgwidth))
549 avgwidth = 0; 549 avgwidth = 0;
550 550
551 char *weight = get_property (f, "WEIGHT_NAME", "medium"); 551 char *weight = get_property (f, "WEIGHT_NAME", "medium");
552 char *slant = get_property (f, "SLANT", "r"); 552 char *slant = get_property (f, "SLANT", "r");
553 553
884void 884void
885rxvt_font_x11::clear () 885rxvt_font_x11::clear ()
886{ 886{
887 if (f) 887 if (f)
888 { 888 {
889 XFreeFont (term->display->display, f); 889 XFreeFont (term->xdisp, f);
890 f = 0; 890 f = 0;
891 } 891 }
892} 892}
893 893
894bool 894bool
1066void 1066void
1067rxvt_font_xft::clear () 1067rxvt_font_xft::clear ()
1068{ 1068{
1069 if (f) 1069 if (f)
1070 { 1070 {
1071 XftFontClose (term->display->display, f); 1071 XftFontClose (term->xdisp, f);
1072 f = 0; 1072 f = 0;
1073 } 1073 }
1074} 1074}
1075 1075
1076rxvt_fontprop 1076rxvt_fontprop
1243bool 1243bool
1244rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const 1244rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const
1245{ 1245{
1246 careful = false; 1246 careful = false;
1247 1247
1248 if (!XftCharExists (term->display->display, f, unicode)) 1248 if (!XftCharExists (term->xdisp, f, unicode))
1249 return false; 1249 return false;
1250 1250
1251 if (!prop || prop->width == rxvt_fontprop::unset) 1251 if (!prop || prop->width == rxvt_fontprop::unset)
1252 return true; 1252 return true;
1253 1253
1254 // check character against base font bounding box 1254 // check character against base font bounding box
1255 FcChar32 ch = unicode; 1255 FcChar32 ch = unicode;
1256 XGlyphInfo g; 1256 XGlyphInfo g;
1257 XftTextExtents32 (term->display->display, f, &ch, 1, &g); 1257 XftTextExtents32 (term->xdisp, f, &ch, 1, &g);
1258 1258
1259 int w = g.width - g.x; 1259 int w = g.width - g.x;
1260 int wcw = WCWIDTH (unicode); 1260 int wcw = WCWIDTH (unicode);
1261 if (wcw > 0) w = (w + wcw - 1) / wcw; 1261 if (wcw > 0) w = (w + wcw - 1) / wcw;
1262 1262
1560 FcPatternAddInteger (p, FC_SLANT, prop.slant); 1560 FcPatternAddInteger (p, FC_SLANT, prop.slant);
1561 FcPatternAddBool (p, FC_MINSPACE, 1); 1561 FcPatternAddBool (p, FC_MINSPACE, 1);
1562 //FcPatternAddBool (p, FC_ANTIALIAS, 1); 1562 //FcPatternAddBool (p, FC_ANTIALIAS, 1);
1563 1563
1564 XftResult result; 1564 XftResult result;
1565 FcPattern *match = XftFontMatch (term->display->display, term->display->screen, p, &result); 1565 FcPattern *match = XftFontMatch (term->xdisp, term->display->screen, p, &result);
1566 1566
1567 FcPatternDestroy (p); 1567 FcPatternDestroy (p);
1568 1568
1569 if (match) 1569 if (match)
1570 { 1570 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines