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.77 by root, Wed Jan 4 20:43:38 2006 UTC vs.
Revision 1.80 by root, Mon Jan 9 07:17:24 2006 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: rxvtfont.C 2 * File: rxvtfont.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 4 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
5 * - original version. 5 * - original version.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
308 308
309 if (unicode <= 0x009f) 309 if (unicode <= 0x009f)
310 return true; 310 return true;
311 311
312 if (unicode >= 0x2500 && unicode <= 0x259f && 312 if (unicode >= 0x2500 && unicode <= 0x259f &&
313 ! OPTION_R (Opt_skipBuiltinGlyphs)) 313 !r->option (Opt_skipBuiltinGlyphs))
314 return true; 314 return true;
315 315
316 if (IS_COMPOSE (unicode)) 316 if (IS_COMPOSE (unicode))
317 return true; 317 return true;
318 318
354 ; 354 ;
355 355
356 int width = text - tp; 356 int width = text - tp;
357 int fwidth = r->fwidth * width; 357 int fwidth = r->fwidth * width;
358 358
359 if (0x2500 <= t && t <= 0x259f && 359 if (0x2500 <= t && t <= 0x259f)
360 ! OPTION_R (Opt_skipBuiltinGlyphs))
361 { 360 {
362 uint16_t offs = linedraw_offs[t - 0x2500]; 361 uint16_t offs = linedraw_offs[t - 0x2500];
363 uint32_t *a = linedraw_command + (offs >> 4); 362 uint32_t *a = linedraw_command + (offs >> 4);
364 uint32_t *b = a + (offs & 15); 363 uint32_t *b = a + (offs & 15);
365 364
1275 clear_rect (d, x, y, r->fwidth * len, r->fheight, bg); 1274 clear_rect (d, x, y, r->fwidth * len, r->fheight, bg);
1276 1275
1277 int base = ascent; // should be fbase, but that is incorrect 1276 int base = ascent; // should be fbase, but that is incorrect
1278 1277
1279 XGlyphInfo extents; 1278 XGlyphInfo extents;
1280 FcChar32 *enc = (FcChar32 *) get_enc_buf (len * sizeof (FcChar32)); 1279 XftGlyphSpec *enc = (XftGlyphSpec *) get_enc_buf (len * sizeof (XftGlyphSpec));
1281 FcChar32 *ep = enc; 1280 XftGlyphSpec *ep = enc;
1282 int ewidth = 0; 1281
1282 // skip trailing spaces
1283 while (len && text [len - 1] == ' ')
1284 len--;
1283 1285
1284 while (len) 1286 while (len)
1285 { 1287 {
1286 int cwidth = r->fwidth; 1288 int cwidth = r->fwidth;
1287 FcChar32 fc = *text++; len--; 1289 FcChar32 fc = *text++; len--;
1288 1290
1289 while (len && *text == NOCHAR) 1291 while (len && *text == NOCHAR)
1290 text++, len--, cwidth += r->fwidth; 1292 text++, len--, cwidth += r->fwidth;
1291 1293
1292 if (fc == ' ' && ep == enc) // skip leading spaces 1294 if (fc != ' ') // skip spaces
1293 x += cwidth;
1294 else
1295 { 1295 {
1296 FT_UInt gl = XftCharIndex (d.display->display, f, fc); 1296 FT_UInt gl = XftCharIndex (d.display->display, f, fc);
1297 XftGlyphExtents (d.display->display, f, &gl, 1, &extents); 1297 XftGlyphExtents (d.display->display, f, &gl, 1, &extents);
1298 1298
1299 if (extents.xOff != cwidth) 1299 ep->glyph = gl;
1300 { 1300 ep->x = x + (cwidth - extents.xOff >> 1);
1301 if (ewidth) 1301 ep->y = y + base;
1302 { 1302 ep++;
1303 XftDrawGlyphs (d, &r->pix_colors[fg].c, f,
1304 x, y + base, enc, ep - enc);
1305 x += ewidth;
1306
1307 ep = enc;
1308 ewidth = 0;
1309 }
1310
1311 if (extents.xOff > cwidth)
1312 extents.xOff = cwidth;
1313
1314 XftDrawGlyphs (d, &r->pix_colors[fg].c, f,
1315 x + (cwidth - extents.xOff >> 1),
1316 y + base, &gl, 1);
1317 x += cwidth;
1318 } 1303 }
1319 else 1304
1320 { 1305 x += cwidth;
1321 *ep++ = gl;
1322 ewidth += cwidth;
1323 }
1324 }
1325 } 1306 }
1326 1307
1327 if (ep != enc) 1308 if (ep != enc)
1328 XftDrawGlyphs (d, &r->pix_colors[fg].c, f, 1309 XftDrawGlyphSpec (d, &r->pix_colors[fg].c, f, enc, ep - enc);
1329 x, y + base, enc, ep - enc);
1330} 1310}
1331#endif 1311#endif
1332 1312
1333///////////////////////////////////////////////////////////////////////////// 1313/////////////////////////////////////////////////////////////////////////////
1334 1314

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines