… | |
… | |
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 < best; 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; |