mirror of https://github.com/adamdruppe/arsd.git
nanovega: made fontconfig less aggressive
This commit is contained in:
parent
819c3fdf90
commit
a055c35e9a
|
@ -10353,6 +10353,11 @@ public int fonsAddFont (FONScontext* stash, const(char)[] name, const(char)[] pa
|
|||
// if loading failed, try fontconfig (if fontconfig is available)
|
||||
static if (NanoVegaHasFontConfig) {
|
||||
if (res == FONS_INVALID && fontconfigAvailable) {
|
||||
// idiotic fontconfig NEVER fails; let's skip it if `path` looks like a path
|
||||
bool ok = true;
|
||||
if (path.length > 4 && (path[$-4..$] == ".ttf" || path[$-4..$] == ".ttc")) ok = false;
|
||||
if (ok) { foreach (immutable char ch; path) if (ch == '/') { ok = false; break; } }
|
||||
if (ok) {
|
||||
import std.internal.cstring : tempCString;
|
||||
FcPattern* pat = FcNameParse(path.tempCString);
|
||||
if (pat !is null) {
|
||||
|
@ -10376,6 +10381,7 @@ public int fonsAddFont (FONScontext* stash, const(char)[] name, const(char)[] pa
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue