diff options
| -rw-r--r-- | st.c | 21 |
1 files changed, 15 insertions, 6 deletions
| @@ -363,6 +363,7 @@ static void xloadcols(void); | |||
| 363 | static int xsetcolorname(int, const char *); | 363 | static int xsetcolorname(int, const char *); |
| 364 | static int xloadfont(Font *, FcPattern *); | 364 | static int xloadfont(Font *, FcPattern *); |
| 365 | static void xloadfonts(char *, int); | 365 | static void xloadfonts(char *, int); |
| 366 | static int xloadfontset(Font *); | ||
| 366 | static void xsettitle(char *); | 367 | static void xsettitle(char *); |
| 367 | static void xresettitle(void); | 368 | static void xresettitle(void); |
| 368 | static void xseturgency(int); | 369 | static void xseturgency(int); |
| @@ -2643,16 +2644,12 @@ xloadfont(Font *f, FcPattern *pattern) { | |||
| 2643 | if(!match) | 2644 | if(!match) |
| 2644 | return 1; | 2645 | return 1; |
| 2645 | 2646 | ||
| 2646 | if(!(f->set = FcFontSort(0, match, FcTrue, 0, &result))) { | ||
| 2647 | FcPatternDestroy(match); | ||
| 2648 | return 1; | ||
| 2649 | } | ||
| 2650 | |||
| 2651 | if(!(f->match = XftFontOpenPattern(xw.dpy, match))) { | 2647 | if(!(f->match = XftFontOpenPattern(xw.dpy, match))) { |
| 2652 | FcPatternDestroy(match); | 2648 | FcPatternDestroy(match); |
| 2653 | return 1; | 2649 | return 1; |
| 2654 | } | 2650 | } |
| 2655 | 2651 | ||
| 2652 | f->set = NULL; | ||
| 2656 | f->pattern = FcPatternDuplicate(pattern); | 2653 | f->pattern = FcPatternDuplicate(pattern); |
| 2657 | 2654 | ||
| 2658 | f->ascent = f->match->ascent; | 2655 | f->ascent = f->match->ascent; |
| @@ -2727,6 +2724,15 @@ xloadfonts(char *fontstr, int fontsize) { | |||
| 2727 | FcPatternDestroy(pattern); | 2724 | FcPatternDestroy(pattern); |
| 2728 | } | 2725 | } |
| 2729 | 2726 | ||
| 2727 | int | ||
| 2728 | xloadfontset(Font *f) { | ||
| 2729 | FcResult result; | ||
| 2730 | |||
| 2731 | if(!(f->set = FcFontSort(0, f->pattern, FcTrue, 0, &result))) | ||
| 2732 | return 1; | ||
| 2733 | return 0; | ||
| 2734 | } | ||
| 2735 | |||
| 2730 | void | 2736 | void |
| 2731 | xunloadfonts(void) { | 2737 | xunloadfonts(void) { |
| 2732 | int i, ip; | 2738 | int i, ip; |
| @@ -2987,7 +2993,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
| 2987 | r.width = width; | 2993 | r.width = width; |
| 2988 | XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); | 2994 | XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); |
| 2989 | 2995 | ||
| 2990 | fcsets[0] = font->set; | ||
| 2991 | for(xp = winx; bytelen > 0;) { | 2996 | for(xp = winx; bytelen > 0;) { |
| 2992 | /* | 2997 | /* |
| 2993 | * Search for the range in the to be printed string of glyphs | 2998 | * Search for the range in the to be printed string of glyphs |
| @@ -3045,6 +3050,10 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
| 3045 | 3050 | ||
| 3046 | /* Nothing was found. */ | 3051 | /* Nothing was found. */ |
| 3047 | if(i >= frclen) { | 3052 | if(i >= frclen) { |
| 3053 | if(!font->set) | ||
| 3054 | xloadfontset(font); | ||
| 3055 | fcsets[0] = font->set; | ||
| 3056 | |||
| 3048 | /* | 3057 | /* |
| 3049 | * Nothing was found in the cache. Now use | 3058 | * Nothing was found in the cache. Now use |
| 3050 | * some dozen of Fontconfig calls to get the | 3059 | * some dozen of Fontconfig calls to get the |
