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.200 by root, Thu Jun 17 00:49:20 2021 UTC vs.
Revision 1.203 by root, Thu Jun 17 11:21:52 2021 UTC

313 if (unicode >= 0x2500 && unicode <= 0x259f && 313 if (unicode >= 0x2500 && unicode <= 0x259f &&
314 !term->option (Opt_skipBuiltinGlyphs)) 314 !term->option (Opt_skipBuiltinGlyphs))
315 return true; 315 return true;
316#endif 316#endif
317 317
318 if (IS_COMPOSE (unicode)) 318 // we do not check for IS_COMPOSE here, as this would
319 return true; 319 // rob other fonts from taking over.
320 320
321 switch (unicode) 321 switch (unicode)
322 { 322 {
323 case ZERO_WIDTH_CHAR: 323 case ZERO_WIDTH_CHAR:
324 case NOCHAR: 324 case NOCHAR:
442#else 442#else
443 if (0) 443 if (0)
444 ; 444 ;
445#endif 445#endif
446#if ENABLE_COMBINING 446#if ENABLE_COMBINING
447 else if (IS_COMPOSE (t) && rxvt_composite[t]) 447 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
448 { 448 {
449 min_it (width, 2); // we only support wcwidth up to 2 449 min_it (width, 2); // we only support wcwidth up to 2
450 450
451 #if NOT_YET 451 #if NOT_YET
452 vector<text_t> chrs; 452 vector<text_t> chrs;
1317 if (glheight < g.height - g.y) glheight = g.height - g.y; 1317 if (glheight < g.height - g.y) glheight = g.height - g.y;
1318 } 1318 }
1319 1319
1320 if (!width) 1320 if (!width)
1321 { 1321 {
1322 rxvt_warn ("unable to calculate font width for '%s', ignoring.\n", name); 1322 rxvt_warn ("unable to calculate font width for '%s', using max_advance_width.\n", name);
1323 1323 width = f->max_advance_width;
1324 XftFontClose (disp, f);
1325 f = 0;
1326
1327 success = false;
1328 break; 1324 break;
1329 } 1325 }
1330 1326
1331 if (prop.height == rxvt_fontprop::unset 1327 if (prop.height == rxvt_fontprop::unset
1332 || (height <= prop.height && glheight <= prop.height) 1328 || (height <= prop.height && glheight <= prop.height)
1367bool 1363bool
1368rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const 1364rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const
1369{ 1365{
1370 careful = false; 1366 careful = false;
1371 1367
1368#if ENABLE_COMBINING && !UNICODE_3
1369 if (ecb_expect_false (IS_COMPOSE (unicode)))
1370 if (compose_char *cc = rxvt_composite[unicode])
1371 if (cc->c2 == NOCHAR)
1372 unicode = cc->c1;
1373#endif
1374
1372 if (!XftCharExists (term->dpy, f, unicode)) 1375 if (!XftCharExists (term->dpy, f, unicode))
1373 return false; 1376 return false;
1374 1377
1375 if (!prop || prop->width == rxvt_fontprop::unset) 1378 if (!prop || prop->width == rxvt_fontprop::unset)
1376 return true; 1379 return true;
1422 1425
1423 while (len) 1426 while (len)
1424 { 1427 {
1425 int cwidth = term->fwidth; 1428 int cwidth = term->fwidth;
1426 FcChar32 fc = *text++; len--; 1429 FcChar32 fc = *text++; len--;
1430
1431#if ENABLE_COMBINING && !UNICODE_3
1432 if (ecb_expect_false (IS_COMPOSE (fc)))
1433 if (compose_char *cc = rxvt_composite[fc]) // should always be true, but better be safe than sorry
1434 fc = cc->c1; // c2 must be NOCHAR, as has_char handles it that way
1435#endif
1427 1436
1428 while (len && *text == NOCHAR) 1437 while (len && *text == NOCHAR)
1429 text++, len--, cwidth += term->fwidth; 1438 text++, len--, cwidth += term->fwidth;
1430 1439
1431 if (fc != ' ') // skip spaces 1440 if (fc != ' ') // skip spaces
1717} 1726}
1718 1727
1719int 1728int
1720rxvt_fontset::find_font_idx (unicode_t unicode) 1729rxvt_fontset::find_font_idx (unicode_t unicode)
1721{ 1730{
1722 if (unicode >= 1<<20) 1731 // this limits fmap size. it has to accomodate COMPOSE_HI when UNICODE_3
1732 if (unicode > 0x1fffff)
1723 return 0; 1733 return 0;
1724 1734
1725 unicode_t hi = unicode >> 8; 1735 unicode_t hi = unicode >> 8;
1726 1736
1727 if (hi < fmap.size () 1737 if (hi < fmap.size ())
1728 && fmap[hi] 1738 if (pagemap *pm = fmap[hi])
1729 && (*fmap[hi])[unicode & 0xff] != 0xff) 1739 if ((*pm)[unicode & 0xff] != 0xff)
1730 return (*fmap[hi])[unicode & 0xff]; 1740 return (*pm)[unicode & 0xff];
1731 1741
1732 unsigned int i; 1742 unsigned int i;
1733 1743
1734 for (i = 0; i < fonts.size (); i++) 1744 for (i = 0; i < fonts.size (); i++)
1735 { 1745 {
1759 } 1769 }
1760 1770
1761 next_font: 1771 next_font:
1762 if (i == fonts.size () - 1) 1772 if (i == fonts.size () - 1)
1763 { 1773 {
1774 // compose characters are handled by the default font, unless another font takes over
1775 // we do not go via the fallback list for speed reasons.
1776 if (IS_COMPOSE (unicode))
1777 return 0;
1778
1764 if (fallback->name) 1779 if (fallback->name)
1765 { 1780 {
1766 // search through the fallback list 1781 // search through the fallback list
1767 push_font (new_font (fallback->name, fallback->cs)); 1782 push_font (new_font (fallback->name, fallback->cs));
1768 fallback++; 1783 fallback++;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines