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.155 by root, Tue Mar 30 23:00:35 2010 UTC vs.
Revision 1.156 by root, Tue Mar 30 23:36:14 2010 UTC

1586 1586
1587 return -1; 1587 return -1;
1588} 1588}
1589 1589
1590int 1590int
1591rxvt_fontset::find_font_ (unicode_t unicode) 1591rxvt_fontset::find_font_idx (unicode_t unicode, bool &careful)
1592{ 1592{
1593 if (unicode >= 1<<20) 1593 if (unicode >= 1<<20)
1594 return 0; 1594 return 0;
1595 1595
1596 unicode_t hi = unicode >> 8; 1596 unicode_t hi = unicode >> 8;
1597 1597
1598 if (hi < fmap.size () 1598 if (hi < fmap.size () && fmap[hi])
1599 && fmap[hi] 1599 {
1600 && (*fmap[hi])[unicode & 0xff] != 0xff) 1600 unsigned char m = (*fmap[hi])[unicode & 0xff];
1601 return (*fmap[hi])[unicode & 0xff]; 1601
1602 if (m != 0xff)
1603 {
1604 careful = m & 128;
1605 return m & 127;
1606 }
1607 }
1602 1608
1603 unsigned int i; 1609 unsigned int i;
1604 1610
1605 for (i = 0; i < fonts.size (); i++) 1611 for (i = 0; i < fonts.size (); i++)
1606 { 1612 {
1619 } 1625 }
1620 1626
1621 if (f->cs == CS_UNKNOWN) 1627 if (f->cs == CS_UNKNOWN)
1622 goto next_font; 1628 goto next_font;
1623 1629
1624 bool careful;
1625 if (f->has_char (unicode, &prop, careful)) 1630 if (f->has_char (unicode, &prop, careful))
1626 {
1627 if (careful)
1628 i |= 128;
1629
1630 goto found; 1631 goto found;
1631 }
1632 1632
1633 next_font: 1633 next_font:
1634 if (i == fonts.size () - 1) 1634 if (i == fonts.size () - 1)
1635 { 1635 {
1636 if (fallback->name) 1636 if (fallback->name)
1689 } 1689 }
1690 } 1690 }
1691 1691
1692 /* we must return SOME font */ 1692 /* we must return SOME font */
1693 i = 0; 1693 i = 0;
1694 careful = false;
1694 1695
1695found: 1696found:
1696 // found a font, cache it 1697 // found a font, cache it
1697 if (i < 255) 1698 if (i < 255)
1698 { 1699 {
1703 { 1704 {
1704 fmap[hi] = (pagemap *)new pagemap; 1705 fmap[hi] = (pagemap *)new pagemap;
1705 memset (fmap[hi], 0xff, sizeof (pagemap)); 1706 memset (fmap[hi], 0xff, sizeof (pagemap));
1706 } 1707 }
1707 1708
1708 (*fmap[hi])[unicode & 0xff] = i; 1709 (*fmap[hi])[unicode & 0xff] = i | (careful ? 128 : 0);
1709 } 1710 }
1710 1711
1711 return i; 1712 return i;
1712} 1713}
1713 1714
1714int 1715int
1715rxvt_fontset::find_font (unicode_t unicode) 1716rxvt_fontset::find_font (unicode_t unicode)
1716{ 1717{
1717 return min<int> (fontCount, find_font_ (unicode)); 1718 bool careful;
1718} 1719 int id = find_font_idx (unicode, careful);
1719 1720
1721 return min<int> (fontCount, id) | (careful ? Careful : 0);
1722}
1720 1723
1721

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines