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.80 by root, Mon Jan 9 07:17:24 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines