diff options
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -3373,16 +3373,32 @@ xgeommasktogravity(int mask) | |||
3373 | int | 3373 | int |
3374 | xloadfont(Font *f, FcPattern *pattern) | 3374 | xloadfont(Font *f, FcPattern *pattern) |
3375 | { | 3375 | { |
3376 | FcPattern *configured; | ||
3376 | FcPattern *match; | 3377 | FcPattern *match; |
3377 | FcResult result; | 3378 | FcResult result; |
3378 | XGlyphInfo extents; | 3379 | XGlyphInfo extents; |
3379 | int wantattr, haveattr; | 3380 | int wantattr, haveattr; |
3380 | 3381 | ||
3381 | match = XftFontMatch(xw.dpy, xw.scr, pattern, &result); | 3382 | /* |
3382 | if (!match) | 3383 | * Manually configure instead of calling XftMatchFont |
3384 | * so that we can use the configured pattern for | ||
3385 | * "missing glyph" lookups. | ||
3386 | */ | ||
3387 | configured = FcPatternDuplicate(pattern); | ||
3388 | if (!configured) | ||
3389 | return 1; | ||
3390 | |||
3391 | FcConfigSubstitute(NULL, configured, FcMatchPattern); | ||
3392 | XftDefaultSubstitute(xw.dpy, xw.scr, configured); | ||
3393 | |||
3394 | match = FcFontMatch(NULL, configured, &result); | ||
3395 | if (!match) { | ||
3396 | FcPatternDestroy(configured); | ||
3383 | return 1; | 3397 | return 1; |
3398 | } | ||
3384 | 3399 | ||
3385 | if (!(f->match = XftFontOpenPattern(xw.dpy, match))) { | 3400 | if (!(f->match = XftFontOpenPattern(xw.dpy, match))) { |
3401 | FcPatternDestroy(configured); | ||
3386 | FcPatternDestroy(match); | 3402 | FcPatternDestroy(match); |
3387 | return 1; | 3403 | return 1; |
3388 | } | 3404 | } |
@@ -3414,7 +3430,7 @@ xloadfont(Font *f, FcPattern *pattern) | |||
3414 | strlen(ascii_printable), &extents); | 3430 | strlen(ascii_printable), &extents); |
3415 | 3431 | ||
3416 | f->set = NULL; | 3432 | f->set = NULL; |
3417 | f->pattern = FcPatternDuplicate(pattern); | 3433 | f->pattern = configured; |
3418 | 3434 | ||
3419 | f->ascent = f->match->ascent; | 3435 | f->ascent = f->match->ascent; |
3420 | f->descent = f->match->descent; | 3436 | f->descent = f->match->descent; |