ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/defaultfont.C
(Generate patch)

Comparing rxvt-unicode/src/defaultfont.C (file contents):
Revision 1.49 by pcg, Mon Mar 22 15:15:04 2004 UTC vs.
Revision 1.53 by root, Mon Jun 21 19:09:44 2004 UTC

1/*--------------------------------*-C-*---------------------------------*; 1/*--------------------------------*-C-*---------------------------------*
2 * File: defaultfont.C 2 * File: defaultfont.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 4 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
5 * - original version. 5 * - original version.
6 * 6 *
30 30
31const struct rxvt_fallback_font { 31const struct rxvt_fallback_font {
32 codeset cs; 32 codeset cs;
33 const char *name; 33 const char *name;
34} fallback_fonts[] = { 34} fallback_fonts[] = {
35 { CS_ISO8859_1, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-1" }, 35 { CS_ISO8859_1, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-1" },
36 { CS_ISO8859_15, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-15" }, 36 { CS_ISO8859_15, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-15" },
37 { CS_ISO8859_15, "-*-*-*-r-*--*-*-*-*-c-*-fcd8859-15" }, 37 { CS_ISO8859_15, "-*-*-*-r-*--*-*-*-*-c-*-fcd8859-15" },
38 38
39#if ENCODING_EU 39#if ENCODING_EU
40 // cyrillic 40 // cyrillic
41 { CS_KOI8_R, "-*-*-*-r-*--*-*-*-*-c-*-koi8-r" }, 41 { CS_KOI8_R, "-*-*-*-r-*--*-*-*-*-c-*-koi8-r" },
42 { CS_KOI8_U, "-*-*-*-r-*--*-*-*-*-c-*-koi8-u" }, 42 { CS_KOI8_U, "-*-*-*-r-*--*-*-*-*-c-*-koi8-u" },
43 43
44 { CS_ISO8859_2, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-2" }, 44 { CS_ISO8859_2, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-2" },
45 { CS_ISO8859_3, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-3" }, 45 { CS_ISO8859_3, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-3" },
46 { CS_ISO8859_4, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-4" }, 46 { CS_ISO8859_4, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-4" },
47 { CS_ISO8859_5, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-5" }, 47 { CS_ISO8859_5, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-5" },
48 { CS_ISO8859_6, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-6" }, 48 { CS_ISO8859_6, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-6" },
49 { CS_ISO8859_7, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-7" }, 49 { CS_ISO8859_7, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-7" },
50 { CS_ISO8859_8, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-8" }, 50 { CS_ISO8859_8, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-8" },
51 { CS_ISO8859_9, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-9" }, 51 { CS_ISO8859_9, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-9" },
52 { CS_ISO8859_10, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-10" }, 52 { CS_ISO8859_10, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-10" },
53 { CS_ISO8859_11, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-11" }, 53 { CS_ISO8859_11, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-11" },
54 { CS_ISO8859_13, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-13" }, 54 { CS_ISO8859_13, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-13" },
55 { CS_ISO8859_14, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-14" }, 55 { CS_ISO8859_14, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-14" },
56 { CS_ISO8859_16, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-16" }, 56 { CS_ISO8859_16, "-*-*-*-r-*--*-*-*-*-c-*-iso8859-16" },
57#endif 57#endif
58 58
59 // japanese 59 // japanese
60#if ENCODING_JP || ENCODING_JP_EXT 60#if ENCODING_JP || ENCODING_JP_EXT
61# if XFT 61# if XFT
62 // prefer xft for complex scripts 62 // prefer xft for complex scripts
63 { CS_UNICODE, "xft:Kochi Gothic:antialias=false" }, 63 { CS_UNICODE, "xft:Kochi Gothic:antialias=false" },
64# endif 64# endif
65 { CS_JIS0201_1976_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0201*-0" }, 65 { CS_JIS0201_1976_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0201*-0" },
66 { CS_JIS0208_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0208*-0" }, 66 { CS_JIS0208_1990_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0208*-0" },
67 { CS_JIS0212_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0212*-0" }, 67 { CS_JIS0212_1990_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0212*-0" },
68#endif 68#endif
69 69
70#if ENCODING_CN || ENCODING_CN_EXT 70#if ENCODING_CN || ENCODING_CN_EXT
71# if XFT 71# if XFT
72 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" }, 72 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" },
89#endif 89#endif
90 90
91#if XFT 91#if XFT
92 { CS_UNICODE, "xft:Andale Mono" }, 92 { CS_UNICODE, "xft:Andale Mono" },
93 { CS_UNICODE, "xft:Arial Unicode MS" }, 93 { CS_UNICODE, "xft:Arial Unicode MS" },
94 { CS_UNICODE, "xft:FreeMono" },
94#endif 95#endif
95 { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" }, 96 { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" },
96 { CS_UNICODE, "xft:FreeMono" },
97 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, 97 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" },
98 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, 98 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" },
99 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, 99 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" },
100 100
101#if UNICODE_3 && XFT 101#if UNICODE_3 && XFT
729 729
730 int base = r->TermWin.fbase; 730 int base = r->TermWin.fbase;
731 731
732 XGCValues v; 732 XGCValues v;
733 v.foreground = r->PixColors[fg]; 733 v.foreground = r->PixColors[fg];
734 v.background = r->PixColors[bg];
735 v.font = f->fid; 734 v.font = f->fid;
736 735
737 if (enc2b) 736 if (enc2b)
738 { 737 {
739 const XChar2b *xc = enc_xchar2b (text, len, cs, slow); 738 const XChar2b *xc = enc_xchar2b (text, len, cs, slow);
740 739
741 if (bg == Color_bg && !slow) 740 if (bg == Color_bg && !slow)
742 { 741 {
742 v.background = r->PixColors[bg];
743 XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); 743 XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v);
744 XDrawImageString16 (d.display->display, d, TGC, x, y + base, xc, len); 744 XDrawImageString16 (d.display->display, d, TGC, x, y + base, xc, len);
745 } 745 }
746 else 746 else
747 { 747 {
769 { 769 {
770 const char *xc = enc_char (text, len, cs, slow); 770 const char *xc = enc_char (text, len, cs, slow);
771 771
772 if (bg == Color_bg && !slow) 772 if (bg == Color_bg && !slow)
773 { 773 {
774 v.background = r->PixColors[bg];
774 XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v); 775 XChangeGC (d.display->display, TGC, GCForeground | GCBackground | GCFont, &v);
775 XDrawImageString (d.display->display, d, TGC, x, y + base, xc, len); 776 XDrawImageString (d.display->display, d, TGC, x, y + base, xc, len);
776 } 777 }
777 else 778 else
778 { 779 {
997#endif 998#endif
998 999
999///////////////////////////////////////////////////////////////////////////// 1000/////////////////////////////////////////////////////////////////////////////
1000 1001
1001rxvt_fontset::rxvt_fontset (rxvt_t r) 1002rxvt_fontset::rxvt_fontset (rxvt_t r)
1002: r (r) 1003: r (r), fontdesc (0)
1003{ 1004{
1004 clear (); 1005 clear ();
1005} 1006}
1006 1007
1007rxvt_fontset::~rxvt_fontset () 1008rxvt_fontset::~rxvt_fontset ()
1012void 1013void
1013rxvt_fontset::clear () 1014rxvt_fontset::clear ()
1014{ 1015{
1015 for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) 1016 for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++)
1016 FONT_UNREF (*i); 1017 FONT_UNREF (*i);
1018
1019 free (fontdesc); fontdesc = 0;
1017 1020
1018 fonts.clear (); 1021 fonts.clear ();
1019 base_id = 0; 1022 base_id = 0;
1020 base_prop.height = 0x7fffffff; 1023 base_prop.height = 0x7fffffff;
1021 base_prop.weight = rxvt_fontprop::medium; 1024 base_prop.weight = rxvt_fontprop::medium;
1129bool 1132bool
1130rxvt_fontset::populate (const char *desc) 1133rxvt_fontset::populate (const char *desc)
1131{ 1134{
1132 clear (); 1135 clear ();
1133 1136
1137 fontdesc = strdup (desc);
1138
1134 fonts.push_back (new_font (0, CS_UNICODE)); 1139 fonts.push_back (new_font (0, CS_UNICODE));
1135 realize_font (0); 1140 realize_font (0);
1136 1141
1137 add_fonts (desc); 1142 add_fonts (desc);
1138 1143

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines