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.211 by root, Fri Jun 18 22:12:30 2021 UTC vs.
Revision 1.214 by root, Sat Jun 19 09:47:41 2021 UTC

1406 while (len) 1406 while (len)
1407 { 1407 {
1408 int cwidth = term->fwidth; 1408 int cwidth = term->fwidth;
1409 FcChar32 chr = *text++; len--; 1409 FcChar32 chr = *text++; len--;
1410 1410
1411 // handle non-bmp chars when text_t is 16 bit
1412 #if ENABLE_COMBINING && !UNICODE_3
1413 if (ecb_expect_false (IS_COMPOSE (chr)))
1414 if (compose_char *cc = rxvt_composite [chr])
1415 if (cc->c2 == NOCHAR)
1416 chr = cc->c1;
1417 #endif
1418
1419 while (len && *text == NOCHAR) 1411 while (len && *text == NOCHAR)
1420 text++, len--, cwidth += term->fwidth; 1412 text++, len--, cwidth += term->fwidth;
1421 1413
1422 if (chr != ' ') // skip spaces 1414 if (chr != ' ') // skip spaces
1423 { 1415 {
1416 // handle non-bmp chars when text_t is 16 bit
1417 #if ENABLE_COMBINING && !UNICODE_3
1418 if (ecb_expect_false (IS_COMPOSE (chr)))
1419 if (compose_char *cc = rxvt_composite [chr])
1420 if (cc->c2 == NOCHAR)
1421 chr = cc->c1;
1422 #endif
1423
1424 #if 0 1424 #if 0
1425 FT_UInt glyphs [decltype (exp)::max_size]; 1425 FT_UInt glyphs [decltype (exp)::max_size];
1426 1426
1427 for (int i = 0; i < nchrs; ++i) 1427 for (int i = 0; i < nchrs; ++i)
1428 glyphs [i] = XftCharIndex (disp, f, chrs [i]); 1428 glyphs [i] = XftCharIndex (disp, f, chrs [i]);
1437 1437
1438 FT_UInt glyph = XftCharIndex (disp, f, chr); 1438 FT_UInt glyph = XftCharIndex (disp, f, chr);
1439 XGlyphInfo extents; 1439 XGlyphInfo extents;
1440 XftGlyphExtents (disp, f, &glyph, 1, &extents); 1440 XftGlyphExtents (disp, f, &glyph, 1, &extents);
1441 1441
1442 int xOff = extents.xOff ? extents.xOff : cwidth;
1443
1442 ep->glyph = glyph; 1444 ep->glyph = glyph;
1443 ep->x = x_; 1445 ep->x = x_;
1444 ep->y = y_ + ascent; 1446 ep->y = y_ + ascent;
1445 1447
1446 // the xft font cell might differ from the terminal font cell, 1448 // the xft font cell might differ from the terminal font cell,
1447 // in which we use the average between the two 1449 // in which case we use the average between the two.
1448 ep->x += cwidth - extents.xOff >> 1; 1450 if (extents.xOff)
1451 ep->x += extents.xOff ? cwidth - extents.xOff >> 1 : 0;
1449 1452
1450 // xft/freetype represent combining characters as characters with zero 1453 // xft/freetype represent combining characters as characters with zero
1451 // width rendered over the previous character with some fonts, while 1454 // width rendered over the previous character with some fonts, while
1452 // in other fonts, they are considered normal characters, while yet 1455 // in other fonts, they are considered normal characters, while yet
1453 // in other fonts, they are shifted all over the place. 1456 // in other fonts, they are shifted all over the place.
1454 // we handle the first two cases by keying off on xOff being 0 1457 // we handle the first two cases by keying off on xOff being 0
1455 // for zero-width chars. normally, we would add extents.xOff 1458 // for zero-width chars. normally, we would add extents.xOff
1456 // of the base chaarcter here, but we don't have that, so we use cwidth. 1459 // of the base character here, but we don't have that, so we use cwidth.
1457 ep->x += extents.xOff ? 0 : cwidth; 1460 ep->x += extents.xOff ? 0 : cwidth;
1458 1461
1459 ++ep; 1462 ++ep;
1460 } 1463 }
1461 1464
1733} 1736}
1734 1737
1735int 1738int
1736rxvt_fontset::find_font_idx (unicode_t unicode) 1739rxvt_fontset::find_font_idx (unicode_t unicode)
1737{ 1740{
1738 // this limits fmap size. it has to accomodate COMPOSE_HI when UNICODE_3 1741 // this limits fmap size. it has to accommodate COMPOSE_HI when UNICODE_3
1739 if (unicode > 0x1fffff) 1742 if (unicode > 0x1fffff)
1740 return 0; 1743 return 0;
1741 1744
1742 unicode_t hi = unicode >> 8; 1745 unicode_t hi = unicode >> 8;
1743 1746

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines