mirror of
https://github.com/pikami/st.git
synced 2024-12-01 16:25:43 +00:00
Add a hack to handle unknown chars in fontconfig.
The unicode long is added to the cache. So when fontconfig does fall back to the default font (where there is no easy way to find this out from the pattern) it isn't reloaded.
This commit is contained in:
parent
487bbb24d0
commit
b0bddc694a
19
st.c
19
st.c
@ -522,6 +522,7 @@ enum {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
XftFont *font;
|
XftFont *font;
|
||||||
int flags;
|
int flags;
|
||||||
|
long unicodep;
|
||||||
} Fontcache;
|
} Fontcache;
|
||||||
|
|
||||||
/* Fontcache is an array now. A new font will be appended to the array. */
|
/* Fontcache is an array now. A new font will be appended to the array. */
|
||||||
@ -3208,7 +3209,7 @@ void
|
|||||||
xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
||||||
int winx = borderpx + x * xw.cw, winy = borderpx + y * xw.ch,
|
int winx = borderpx + x * xw.cw, winy = borderpx + y * xw.ch,
|
||||||
width = charlen * xw.cw, xp, i;
|
width = charlen * xw.cw, xp, i;
|
||||||
int frcflags;
|
int frcflags, charexists;
|
||||||
int u8fl, u8fblen, u8cblen, doesexist;
|
int u8fl, u8fblen, u8cblen, doesexist;
|
||||||
char *u8c, *u8fs;
|
char *u8c, *u8fs;
|
||||||
long unicodep;
|
long unicodep;
|
||||||
@ -3391,8 +3392,13 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
|||||||
|
|
||||||
/* Search the font cache. */
|
/* Search the font cache. */
|
||||||
for(i = 0; i < frclen; i++) {
|
for(i = 0; i < frclen; i++) {
|
||||||
if(XftCharExists(xw.dpy, frc[i].font, unicodep)
|
charexists = XftCharExists(xw.dpy, frc[i].font, unicodep);
|
||||||
&& frc[i].flags == frcflags) {
|
/* Everything correct. */
|
||||||
|
if(charexists && frc[i].flags == frcflags)
|
||||||
|
break;
|
||||||
|
/* We got a default font for a not found glyph. */
|
||||||
|
if(!charexists && frc[i].flags == frcflags \
|
||||||
|
&& unicodep == unicodep) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3421,10 +3427,11 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
|||||||
|
|
||||||
FcConfigSubstitute(0, fcpattern,
|
FcConfigSubstitute(0, fcpattern,
|
||||||
FcMatchPattern);
|
FcMatchPattern);
|
||||||
|
FcPatternPrint(fcpattern);
|
||||||
FcDefaultSubstitute(fcpattern);
|
FcDefaultSubstitute(fcpattern);
|
||||||
|
|
||||||
fontpattern = FcFontSetMatch(0, fcsets,
|
fontpattern = FcFontSetMatch(0, fcsets, 1,
|
||||||
FcTrue, fcpattern, &fcres);
|
fcpattern, &fcres);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Overwrite or create the new cache entry.
|
* Overwrite or create the new cache entry.
|
||||||
@ -3432,11 +3439,13 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
|||||||
if(frclen >= LEN(frc)) {
|
if(frclen >= LEN(frc)) {
|
||||||
frclen = LEN(frc) - 1;
|
frclen = LEN(frc) - 1;
|
||||||
XftFontClose(xw.dpy, frc[frclen].font);
|
XftFontClose(xw.dpy, frc[frclen].font);
|
||||||
|
frc[frclen].unicodep = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
frc[frclen].font = XftFontOpenPattern(xw.dpy,
|
frc[frclen].font = XftFontOpenPattern(xw.dpy,
|
||||||
fontpattern);
|
fontpattern);
|
||||||
frc[frclen].flags = frcflags;
|
frc[frclen].flags = frcflags;
|
||||||
|
frc[frclen].unicodep = unicodep;
|
||||||
|
|
||||||
i = frclen;
|
i = frclen;
|
||||||
frclen++;
|
frclen++;
|
||||||
|
Loading…
Reference in New Issue
Block a user