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.159 by sf-exg, Wed Mar 31 13:14:50 2010 UTC vs.
Revision 1.161 by root, Wed Mar 31 22:22:32 2010 UTC

482 482
483 x += fwidth; 483 x += fwidth;
484 } 484 }
485} 485}
486 486
487struct rxvt_font_meta : rxvt_font {
488 struct rxvt_fontset *fs;
489
490 rxvt_font_meta (rxvt_fontset *fs)
491 : rxvt_font ()
492 {
493 this->fs = fs;
494 }
495
496 rxvt_fontprop properties ()
497 {
498 rxvt_fontprop p;
499
500 p.width = p.height = 1;
501 p.ascent = rxvt_fontprop::unset;
502 p.weight = rxvt_fontprop::medium;
503 p.slant = rxvt_fontprop::roman;
504
505 return p;
506 }
507
508 bool load (const rxvt_fontprop &prop, bool force_prop)
509 {
510 width = 1; height = 1;
511 ascent = 1; descent = 0;
512
513 set_name (strdup ("built-in meta font"));
514
515 return true;
516 }
517
518 bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const
519 {
520 return false;
521 }
522
523 void draw (rxvt_drawable &d, int x, int y,
524 const text_t *text, int len,
525 int fg, int bg)
526 {
527 while (len--)
528 {
529 int fid = fs->find_font_idx (*text);
530 (*fs)[fid]->draw (d, x, y, text, 1, fg, bg);
531 ++text;
532 x += term->fwidth;
533 }
534 }
535};
536
487///////////////////////////////////////////////////////////////////////////// 537/////////////////////////////////////////////////////////////////////////////
488 538
489struct rxvt_font_x11 : rxvt_font { 539struct rxvt_font_x11 : rxvt_font {
490 rxvt_font_x11 () { f = 0; } 540 rxvt_font_x11 () { f = 0; }
491 541
1586 1636
1587 return -1; 1637 return -1;
1588} 1638}
1589 1639
1590int 1640int
1591rxvt_fontset::find_font (unicode_t unicode) 1641rxvt_fontset::find_font_idx (unicode_t unicode)
1592{ 1642{
1593 if (unicode >= 1<<20) 1643 if (unicode >= 1<<20)
1594 return 0; 1644 return 0;
1595 1645
1596 unicode_t hi = unicode >> 8; 1646 unicode_t hi = unicode >> 8;
1622 goto next_font; 1672 goto next_font;
1623 1673
1624 bool careful; 1674 bool careful;
1625 if (f->has_char (unicode, &prop, careful)) 1675 if (f->has_char (unicode, &prop, careful))
1626 { 1676 {
1627 if (careful) 1677 i = (i << 1) | careful;
1628 i |= 128;
1629 1678
1630 goto found; 1679 goto found;
1631 } 1680 }
1632 1681
1633 next_font: 1682 next_font:
1709 } 1758 }
1710 1759
1711 return i; 1760 return i;
1712} 1761}
1713 1762
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