… | |
… | |
22 | #include "../config.h" |
22 | #include "../config.h" |
23 | #include "rxvt.h" |
23 | #include "rxvt.h" |
24 | #include "rxvtutil.h" |
24 | #include "rxvtutil.h" |
25 | #include "rxvtfont.h" |
25 | #include "rxvtfont.h" |
26 | |
26 | |
27 | #include <cstdlib> |
27 | #include <stdlib.h> |
28 | |
28 | |
29 | #include <inttypes.h> |
29 | #include <inttypes.h> |
30 | |
30 | |
31 | #if XFT |
31 | #if XFT |
32 | # include <fontconfig/fontconfig.h> |
32 | # include <fontconfig/fontconfig.h> |
… | |
… | |
132 | { CS_KSC5601_1987_0, "xft:Baekmuk Gulim:antialias=false" }, |
132 | { CS_KSC5601_1987_0, "xft:Baekmuk Gulim:antialias=false" }, |
133 | { CS_KSC5601_1987_0, "xft::lang=ko:antialias=false" }, |
133 | { CS_KSC5601_1987_0, "xft::lang=ko:antialias=false" }, |
134 | # endif |
134 | # endif |
135 | #endif |
135 | #endif |
136 | |
136 | |
137 | { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" }, |
|
|
138 | //{ CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, // this gem of a font has actual dotted circles within the combining character glyphs. |
137 | //{ CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, // this gem of a font has actual dotted circles within the combining character glyphs. |
139 | #if XFT |
138 | #if XFT |
140 | { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true" }, |
139 | { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true" }, |
141 | { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" }, |
140 | { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" }, |
142 | { CS_UNICODE, "xft:Andale Mono:antialias=false:autohint=false" }, |
141 | { CS_UNICODE, "xft:Andale Mono:antialias=false:autohint=false" }, |
… | |
… | |
524 | |
523 | |
525 | void draw (rxvt_drawable &d, int x, int y, |
524 | void draw (rxvt_drawable &d, int x, int y, |
526 | const text_t *text, int len, |
525 | const text_t *text, int len, |
527 | int fg, int bg) |
526 | int fg, int bg) |
528 | { |
527 | { |
529 | while (len--) |
528 | while (len) |
530 | { |
529 | { |
531 | int fid = fs->find_font_idx (*text); |
530 | int fid = fs->find_font_idx (*text); |
|
|
531 | int w = 1; |
|
|
532 | while (w < len && text[w] == NOCHAR) |
|
|
533 | w++; |
532 | (*fs)[fid]->draw (d, x, y, text, 1, fg, bg); |
534 | (*fs)[fid]->draw (d, x, y, text, w, fg, bg); |
533 | ++text; |
535 | text += w; |
|
|
536 | len -= w; |
534 | x += term->fwidth; |
537 | x += term->fwidth * w; |
535 | } |
538 | } |
536 | } |
539 | } |
537 | }; |
540 | }; |
538 | |
541 | |
539 | ///////////////////////////////////////////////////////////////////////////// |
542 | ///////////////////////////////////////////////////////////////////////////// |
… | |
… | |
813 | XFreeFontNames (list); |
816 | XFreeFontNames (list); |
814 | |
817 | |
815 | // this loop only iterates when the guessed font-size is too small |
818 | // this loop only iterates when the guessed font-size is too small |
816 | for (;;) |
819 | for (;;) |
817 | { |
820 | { |
818 | font_weight *best = fonts + count - 1; |
821 | font_weight *best = fonts; |
819 | |
822 | |
820 | for (font_weight *w = best; w-- > fonts; ) |
823 | for (font_weight *w = fonts + 1; w < fonts + count; w++) |
821 | if (w->diff <= best->diff) |
824 | if (w->diff < best->diff) |
822 | best = w; |
825 | best = w; |
823 | |
826 | |
824 | if (!best->name |
827 | if (!best->name |
825 | || !(f = XLoadQueryFont (disp, best->name))) |
828 | || !(f = XLoadQueryFont (disp, best->name))) |
826 | break; |
829 | break; |
… | |
… | |
921 | } |
924 | } |
922 | #endif |
925 | #endif |
923 | |
926 | |
924 | width = 1; |
927 | width = 1; |
925 | |
928 | |
926 | for (uint16_t *t = extent_test_chars + ARRAY_LENGTH(extent_test_chars); t-- > extent_test_chars; ) |
929 | for (uint16_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++) |
927 | { |
930 | { |
928 | if (FROM_UNICODE (cs, *t) == NOCHAR) |
931 | if (FROM_UNICODE (cs, *t) == NOCHAR) |
929 | continue; |
932 | continue; |
930 | |
933 | |
931 | // ignore characters we wouldn't use anyways |
934 | // ignore characters we wouldn't use anyways |
… | |
… | |
1243 | |
1246 | |
1244 | XftUnlockFace (f); |
1247 | XftUnlockFace (f); |
1245 | |
1248 | |
1246 | int glheight = height; |
1249 | int glheight = height; |
1247 | |
1250 | |
1248 | for (uint16_t *t = extent_test_chars + ARRAY_LENGTH(extent_test_chars); t-- > extent_test_chars; ) |
1251 | for (uint16_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++) |
1249 | { |
1252 | { |
1250 | FcChar16 ch = *t; |
1253 | FcChar16 ch = *t; |
1251 | |
1254 | |
1252 | if (cs != CS_UNICODE |
1255 | if (cs != CS_UNICODE |
1253 | && ch > 0x100 |
1256 | && ch > 0x100 |
… | |
… | |
1782 | while (hi >= fmap.size ()) |
1785 | while (hi >= fmap.size ()) |
1783 | fmap.push_back (0); |
1786 | fmap.push_back (0); |
1784 | |
1787 | |
1785 | if (!fmap[hi]) |
1788 | if (!fmap[hi]) |
1786 | { |
1789 | { |
1787 | fmap[hi] = (pagemap *)new pagemap; |
1790 | fmap[hi] = new pagemap; |
1788 | memset (fmap[hi], 0xff, sizeof (pagemap)); |
1791 | memset (fmap[hi], 0xff, sizeof (pagemap)); |
1789 | } |
1792 | } |
1790 | |
1793 | |
1791 | (*fmap[hi])[unicode & 0xff] = i; |
1794 | (*fmap[hi])[unicode & 0xff] = i; |
1792 | } |
1795 | } |