aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/st.c b/st.c
index e1139ec..e27daf0 100644
--- a/st.c
+++ b/st.c
@@ -522,6 +522,7 @@ enum {
522typedef struct { 522typedef struct {
523 XftFont *font; 523 XftFont *font;
524 int flags; 524 int flags;
525 long unicodep;
525} Fontcache; 526} Fontcache;
526 527
527/* Fontcache is an array now. A new font will be appended to the array. */ 528/* Fontcache is an array now. A new font will be appended to the array. */
@@ -3208,7 +3209,7 @@ void
3208xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { 3209xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
3209 int winx = borderpx + x * xw.cw, winy = borderpx + y * xw.ch, 3210 int winx = borderpx + x * xw.cw, winy = borderpx + y * xw.ch,
3210 width = charlen * xw.cw, xp, i; 3211 width = charlen * xw.cw, xp, i;
3211 int frcflags; 3212 int frcflags, charexists;
3212 int u8fl, u8fblen, u8cblen, doesexist; 3213 int u8fl, u8fblen, u8cblen, doesexist;
3213 char *u8c, *u8fs; 3214 char *u8c, *u8fs;
3214 long unicodep; 3215 long unicodep;
@@ -3391,8 +3392,13 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
3391 3392
3392 /* Search the font cache. */ 3393 /* Search the font cache. */
3393 for(i = 0; i < frclen; i++) { 3394 for(i = 0; i < frclen; i++) {
3394 if(XftCharExists(xw.dpy, frc[i].font, unicodep) 3395 charexists = XftCharExists(xw.dpy, frc[i].font, unicodep);
3395 && frc[i].flags == frcflags) { 3396 /* Everything correct. */
3397 if(charexists && frc[i].flags == frcflags)
3398 break;
3399 /* We got a default font for a not found glyph. */
3400 if(!charexists && frc[i].flags == frcflags \
3401 && unicodep == unicodep) {
3396 break; 3402 break;
3397 } 3403 }
3398 } 3404 }
@@ -3421,10 +3427,11 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
3421 3427
3422 FcConfigSubstitute(0, fcpattern, 3428 FcConfigSubstitute(0, fcpattern,
3423 FcMatchPattern); 3429 FcMatchPattern);
3430 FcPatternPrint(fcpattern);
3424 FcDefaultSubstitute(fcpattern); 3431 FcDefaultSubstitute(fcpattern);
3425 3432
3426 fontpattern = FcFontSetMatch(0, fcsets, 3433 fontpattern = FcFontSetMatch(0, fcsets, 1,
3427 FcTrue, fcpattern, &fcres); 3434 fcpattern, &fcres);
3428 3435
3429 /* 3436 /*
3430 * Overwrite or create the new cache entry. 3437 * Overwrite or create the new cache entry.
@@ -3432,11 +3439,13 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
3432 if(frclen >= LEN(frc)) { 3439 if(frclen >= LEN(frc)) {
3433 frclen = LEN(frc) - 1; 3440 frclen = LEN(frc) - 1;
3434 XftFontClose(xw.dpy, frc[frclen].font); 3441 XftFontClose(xw.dpy, frc[frclen].font);
3442 frc[frclen].unicodep = 0;
3435 } 3443 }
3436 3444
3437 frc[frclen].font = XftFontOpenPattern(xw.dpy, 3445 frc[frclen].font = XftFontOpenPattern(xw.dpy,
3438 fontpattern); 3446 fontpattern);
3439 frc[frclen].flags = frcflags; 3447 frc[frclen].flags = frcflags;
3448 frc[frclen].unicodep = unicodep;
3440 3449
3441 i = frclen; 3450 i = frclen;
3442 frclen++; 3451 frclen++;