… | |
… | |
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> |
… | |
… | |
816 | XFreeFontNames (list); |
816 | XFreeFontNames (list); |
817 | |
817 | |
818 | // 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 |
819 | for (;;) |
819 | for (;;) |
820 | { |
820 | { |
821 | font_weight *best = fonts + count - 1; |
821 | font_weight *best = fonts; |
822 | |
822 | |
823 | for (font_weight *w = fonts; w < fonts + count - 1; w++) |
823 | for (font_weight *w = fonts + 1; w < fonts + count; w++) |
824 | if (w->diff <= best->diff) |
824 | if (w->diff < best->diff) |
825 | best = w; |
825 | best = w; |
826 | |
826 | |
827 | if (!best->name |
827 | if (!best->name |
828 | || !(f = XLoadQueryFont (disp, best->name))) |
828 | || !(f = XLoadQueryFont (disp, best->name))) |
829 | break; |
829 | break; |
… | |
… | |
1499 | |
1499 | |
1500 | for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) |
1500 | for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) |
1501 | (*i)->unref (); |
1501 | (*i)->unref (); |
1502 | |
1502 | |
1503 | for (pagemap **p = fmap.begin (); p != fmap.end (); p++) |
1503 | for (pagemap **p = fmap.begin (); p != fmap.end (); p++) |
1504 | delete *p; |
1504 | delete [] *p; |
1505 | |
1505 | |
1506 | free (fontdesc); fontdesc = 0; |
1506 | free (fontdesc); fontdesc = 0; |
1507 | |
1507 | |
1508 | fonts.clear (); |
1508 | fonts.clear (); |
1509 | |
1509 | |
… | |
… | |
1785 | while (hi >= fmap.size ()) |
1785 | while (hi >= fmap.size ()) |
1786 | fmap.push_back (0); |
1786 | fmap.push_back (0); |
1787 | |
1787 | |
1788 | if (!fmap[hi]) |
1788 | if (!fmap[hi]) |
1789 | { |
1789 | { |
|
|
1790 | // C++ has no separate new and new [] - we need the "new" form, |
|
|
1791 | // just like the syntax implies, but since pagemap is char[], |
|
|
1792 | // C++ chooses the wrong new, so we need the cast and delete []. |
1790 | fmap[hi] = (pagemap *)new pagemap; |
1793 | fmap[hi] = (pagemap *)new pagemap; |
1791 | memset (fmap[hi], 0xff, sizeof (pagemap)); |
1794 | memset (fmap[hi], 0xff, sizeof (pagemap)); |
1792 | } |
1795 | } |
1793 | |
1796 | |
1794 | (*fmap[hi])[unicode & 0xff] = i; |
1797 | (*fmap[hi])[unicode & 0xff] = i; |