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.79 by root, Sun Jan 8 01:02:15 2006 UTC vs.
Revision 1.82 by root, Mon Jan 9 07:35:07 2006 UTC

1271 const text_t *text, int len, 1271 const text_t *text, int len,
1272 int fg, int bg) 1272 int fg, int bg)
1273{ 1273{
1274 clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); 1274 clear_rect (d, x, y, r->fwidth * len, r->fheight, bg);
1275 1275
1276 int base = ascent; // should be fbase, but that is incorrect
1277
1278 XGlyphInfo extents; 1276 XGlyphInfo extents;
1279 FcChar32 *enc = (FcChar32 *) get_enc_buf (len * sizeof (FcChar32)); 1277 XftGlyphSpec *enc = (XftGlyphSpec *)get_enc_buf (len * sizeof (XftGlyphSpec));
1280 FcChar32 *ep = enc; 1278 XftGlyphSpec *ep = enc;
1281 int ewidth = 0; 1279
1280 // cut trailing spaces
1281 while (len && text [len - 1] == ' ')
1282 len--;
1282 1283
1283 while (len) 1284 while (len)
1284 { 1285 {
1285 int cwidth = r->fwidth; 1286 int cwidth = r->fwidth;
1286 FcChar32 fc = *text++; len--; 1287 FcChar32 fc = *text++; len--;
1287 1288
1288 while (len && *text == NOCHAR) 1289 while (len && *text == NOCHAR)
1289 text++, len--, cwidth += r->fwidth; 1290 text++, len--, cwidth += r->fwidth;
1290 1291
1291 if (fc == ' ' && ep == enc) // skip leading spaces 1292 if (fc != ' ') // skip spaces
1292 x += cwidth;
1293 else
1294 { 1293 {
1295 FT_UInt gl = XftCharIndex (d.display->display, f, fc); 1294 FT_UInt glyph = XftCharIndex (d.display->display, f, fc);
1296 XftGlyphExtents (d.display->display, f, &gl, 1, &extents); 1295 XftGlyphExtents (d.display->display, f, &glyph, 1, &extents);
1297 1296
1298 if (extents.xOff != cwidth) 1297 ep->glyph = glyph;
1299 { 1298 ep->x = x + (cwidth - extents.xOff >> 1);
1300 if (ewidth) 1299 ep->y = y + ascent;
1301 { 1300 ep++;
1302 XftDrawGlyphs (d, &r->pix_colors[fg].c, f,
1303 x, y + base, enc, ep - enc);
1304 x += ewidth;
1305
1306 ep = enc;
1307 ewidth = 0;
1308 }
1309
1310 if (extents.xOff > cwidth)
1311 extents.xOff = cwidth;
1312
1313 XftDrawGlyphs (d, &r->pix_colors[fg].c, f,
1314 x + (cwidth - extents.xOff >> 1),
1315 y + base, &gl, 1);
1316 x += cwidth;
1317 } 1301 }
1318 else 1302
1319 { 1303 x += cwidth;
1320 *ep++ = gl;
1321 ewidth += cwidth;
1322 }
1323 }
1324 } 1304 }
1325 1305
1326 if (ep != enc) 1306 if (ep != enc)
1327 XftDrawGlyphs (d, &r->pix_colors[fg].c, f, 1307 XftDrawGlyphSpec (d, &r->pix_colors[fg].c, f, enc, ep - enc);
1328 x, y + base, enc, ep - enc);
1329} 1308}
1330#endif 1309#endif
1331 1310
1332///////////////////////////////////////////////////////////////////////////// 1311/////////////////////////////////////////////////////////////////////////////
1333 1312

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines