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.208 by root, Fri Jun 18 01:50:14 2021 UTC vs.
Revision 1.209 by root, Fri Jun 18 21:58:03 2021 UTC

1412 while (len && *text == NOCHAR) 1412 while (len && *text == NOCHAR)
1413 text++, len--, cwidth += term->fwidth; 1413 text++, len--, cwidth += term->fwidth;
1414 1414
1415 if (chrs [0] != ' ') // skip spaces 1415 if (chrs [0] != ' ') // skip spaces
1416 { 1416 {
1417 #if 0 1417 #if 1
1418 FT_UInt glyphs [decltype (exp)::max_size]; 1418 FT_UInt glyphs [decltype (exp)::max_size];
1419 1419
1420 for (int i = 0; i < nchrs; ++i) 1420 for (int i = 0; i < nchrs; ++i)
1421 glyphs [i] = XftCharIndex (disp, f, chrs [i]); 1421 glyphs [i] = XftCharIndex (disp, f, chrs [i]);
1422 1422
1423 for (int i = 0; i < nchrs; ++i) 1423 for (int i = 0; i < nchrs; ++i)
1424 { 1424 {
1425 XGlyphInfo ep; 1425 XGlyphInfo ep;
1426 XftGlyphExtents (disp, f, glyphs+i, 1, &ep); 1426 XftGlyphExtents (disp, f, glyphs+i, 1, &ep);
1427 printf ("gs %x g %x + %d,%d o %d,%d wh %d,%d\n", chrs[i],glyphs[i],ep.x,ep.y,ep.xOff,ep.yOff,ep.width,ep.height); 1427 printf ("gs %4x g %4x + %3d,%3d o %3d,%3d wh %3d,%3d\n", chrs[i],glyphs[i],ep.x,ep.y,ep.xOff,ep.yOff,ep.width,ep.height);
1428 } 1428 }
1429 #endif 1429 #endif
1430 1430
1431 FT_UInt glyph = XftCharIndex (disp, f, chrs [0]);
1432 XGlyphInfo extents0;
1433 XftGlyphExtents (disp, f, &glyph, 1, &extents0);
1434
1435 int cx = x_ + (cwidth - extents0.xOff >> 1);
1436 int cy = y_ + ascent;
1437
1438 XftGlyphSpec ep;
1439 ep.glyph = glyph;
1440 ep.x = cx + (extents0.xOff ? 0 : extents0.xOff);
1441 ep.y = cy;
1442
1443 enc.push_back (ep);
1444
1431 for (int i = 0; i < nchrs; ++i) 1445 for (int i = 1; ecb_expect_false (i < nchrs); ++i)
1432 { 1446 {
1433 FT_UInt glyph = XftCharIndex (disp, f, chrs [i]); 1447 FT_UInt glyph = XftCharIndex (disp, f, chrs [i]);
1434 XGlyphInfo extents; 1448 XGlyphInfo extents;
1435 XftGlyphExtents (disp, f, &glyph, 1, &extents); 1449 XftGlyphExtents (disp, f, &glyph, 1, &extents);
1436 1450
1437 XftGlyphSpec ep;
1438
1439 int cx = x_ + (cwidth - extents.xOff >> 1);
1440 int cy = y_ + ascent;
1441
1442 // lone combining char
1443 if (extents.xOff == 0)
1444 cx = x_ + cwidth;
1445
1446 ep.glyph = glyph; 1451 ep.glyph = glyph;
1447 ep.x = cx + extents.x; 1452 ep.x = cx + (extents.xOff ? 0 : extents0.xOff);
1448 ep.y = cy;
1449 1453
1450 enc.push_back (ep); 1454 enc.push_back (ep);
1451 } 1455 }
1452 } 1456 }
1453 1457

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines