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.161 by root, Wed Mar 31 22:22:32 2010 UTC vs.
Revision 1.162 by root, Wed Mar 31 22:46:40 2010 UTC

482 482
483 x += fwidth; 483 x += fwidth;
484 } 484 }
485} 485}
486 486
487struct rxvt_font_meta : rxvt_font { 487struct rxvt_font_overflow : rxvt_font {
488 struct rxvt_fontset *fs; 488 struct rxvt_fontset *fs;
489 489
490 rxvt_font_meta (rxvt_fontset *fs) 490 rxvt_font_overflow (rxvt_fontset *fs)
491 : rxvt_font () 491 : rxvt_font ()
492 { 492 {
493 this->fs = fs; 493 this->fs = fs;
494 } 494 }
495 495
508 bool load (const rxvt_fontprop &prop, bool force_prop) 508 bool load (const rxvt_fontprop &prop, bool force_prop)
509 { 509 {
510 width = 1; height = 1; 510 width = 1; height = 1;
511 ascent = 1; descent = 0; 511 ascent = 1; descent = 0;
512 512
513 set_name (strdup ("built-in meta font")); 513 set_name (strdup ("built-in rendition overflow font"));
514 514
515 return true; 515 return true;
516 } 516 }
517 517
518 bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const 518 bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const
1494 fonts.clear (); 1494 fonts.clear ();
1495 1495
1496 fallback = fallback_fonts; 1496 fallback = fallback_fonts;
1497} 1497}
1498 1498
1499void
1500rxvt_fontset::prepare_font (rxvt_font *font, codeset cs)
1501{
1502 font->set_term (term);
1503
1504 font->cs = cs;
1505 font->loaded = false;
1506}
1507
1499rxvt_font * 1508rxvt_font *
1500rxvt_fontset::new_font (const char *name, codeset cs) 1509rxvt_fontset::new_font (const char *name, codeset cs)
1501{ 1510{
1502 rxvt_font *f; 1511 rxvt_font *f;
1503 1512
1519 f = new rxvt_font_x11; 1528 f = new rxvt_font_x11;
1520 } 1529 }
1521 else 1530 else
1522 f = new rxvt_font_x11; 1531 f = new rxvt_font_x11;
1523 1532
1524 f->set_term (term);
1525 f->set_name (strdup (name)); 1533 f->set_name (strdup (name));
1526 1534 prepare_font (f, cs);
1527 f->cs = cs;
1528 f->loaded = false;
1529 1535
1530 return f; 1536 return f;
1531} 1537}
1532 1538
1533///////////////////////////////////////////////////////////////////////////// 1539/////////////////////////////////////////////////////////////////////////////
1540
1541void
1542rxvt_fontset::push_font (rxvt_font *font)
1543{
1544 if (fonts.size () == fontCount)
1545 {
1546 rxvt_font *f = new rxvt_font_overflow (this);
1547
1548 prepare_font (f, CS_UNICODE);
1549 fonts.push_back (f);
1550 }
1551
1552 fonts.push_back (font);
1553}
1534 1554
1535void 1555void
1536rxvt_fontset::add_fonts (const char *desc) 1556rxvt_fontset::add_fonts (const char *desc)
1537{ 1557{
1538 if (desc) 1558 if (desc)
1579 if (end - desc < 511) 1599 if (end - desc < 511)
1580 { 1600 {
1581 memcpy (buf, desc, end - desc); 1601 memcpy (buf, desc, end - desc);
1582 buf[end - desc] = 0; 1602 buf[end - desc] = 0;
1583 1603
1584 fonts.push_back (new_font (buf, cs)); 1604 push_font (new_font (buf, cs));
1585 } 1605 }
1586 else 1606 else
1587 rxvt_warn ("fontset element too long (>511 bytes), ignored."); 1607 rxvt_warn ("fontset element too long (>511 bytes), ignored.");
1588 1608
1589 desc = end + 1; 1609 desc = end + 1;
1617{ 1637{
1618 clear (); 1638 clear ();
1619 1639
1620 fontdesc = strdup (desc); 1640 fontdesc = strdup (desc);
1621 1641
1622 fonts.push_back (new_font (0, CS_UNICODE)); 1642 push_font (new_font (0, CS_UNICODE));
1623 realize_font (0); 1643 realize_font (0);
1624 1644
1625 add_fonts (desc); 1645 add_fonts (desc);
1626 1646
1627 return true; 1647 return true;
1683 if (i == fonts.size () - 1) 1703 if (i == fonts.size () - 1)
1684 { 1704 {
1685 if (fallback->name) 1705 if (fallback->name)
1686 { 1706 {
1687 // search through the fallback list 1707 // search through the fallback list
1688 fonts.push_back (new_font (fallback->name, fallback->cs)); 1708 push_font (new_font (fallback->name, fallback->cs));
1689 fallback++; 1709 fallback++;
1690 } 1710 }
1691 else 1711 else
1692 { 1712 {
1693 // try to find a new font. 1713 // try to find a new font.
1726 if (find_font (font) < 0) 1746 if (find_font (font) < 0)
1727 { 1747 {
1728 char fontname[4096]; 1748 char fontname[4096];
1729 snprintf (fontname, sizeof (fontname), "xft:%s", font); 1749 snprintf (fontname, sizeof (fontname), "xft:%s", font);
1730 1750
1731 fonts.push_back (new_font (fontname, CS_UNICODE)); 1751 push_font (new_font (fontname, CS_UNICODE));
1732 } 1752 }
1733 1753
1734 free (font); 1754 free (font);
1735 } 1755 }
1736#endif 1756#endif
1758 } 1778 }
1759 1779
1760 return i; 1780 return i;
1761} 1781}
1762 1782
1763int
1764rxvt_fontset::find_font (unicode_t unicode)
1765{
1766 return min<int> ((fontCount << 1) | 1, find_font_idx (unicode));
1767}
1768

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines