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