… | |
… | |
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 | XGlyphInfo extents; |
1276 | XGlyphInfo extents; |
1277 | XftGlyphSpec *enc = (XftGlyphSpec *) get_enc_buf (len * sizeof (XftGlyphSpec)); |
1277 | XftGlyphSpec *enc = (XftGlyphSpec *)get_enc_buf (len * sizeof (XftGlyphSpec)); |
1278 | XftGlyphSpec *ep = enc; |
1278 | XftGlyphSpec *ep = enc; |
1279 | |
1279 | |
1280 | // cut trailing spaces |
1280 | // cut trailing spaces |
1281 | while (len && text [len - 1] == ' ') |
1281 | while (len && text [len - 1] == ' ') |
1282 | len--; |
1282 | len--; |
… | |
… | |
1289 | while (len && *text == NOCHAR) |
1289 | while (len && *text == NOCHAR) |
1290 | text++, len--, cwidth += r->fwidth; |
1290 | text++, len--, cwidth += r->fwidth; |
1291 | |
1291 | |
1292 | if (fc != ' ') // skip spaces |
1292 | if (fc != ' ') // skip spaces |
1293 | { |
1293 | { |
1294 | FT_UInt gl = XftCharIndex (d.display->display, f, fc); |
1294 | FT_UInt glyph = XftCharIndex (d.display->display, f, fc); |
1295 | XftGlyphExtents (d.display->display, f, &gl, 1, &extents); |
1295 | XftGlyphExtents (d.display->display, f, &glyph, 1, &extents); |
1296 | |
1296 | |
1297 | ep->glyph = gl; |
1297 | ep->glyph = glyph; |
1298 | ep->x = x + (cwidth - extents.xOff >> 1); |
1298 | ep->x = x + (cwidth - extents.xOff >> 1); |
1299 | ep->y = y + ascent; |
1299 | ep->y = y + ascent; |
1300 | ep++; |
1300 | ep++; |
1301 | } |
1301 | } |
1302 | |
1302 | |