mirror of https://github.com/adamdruppe/arsd.git
ketmar unreachable fix for static if
This commit is contained in:
parent
6b0ad21795
commit
62782c4caf
|
|
@ -9165,6 +9165,7 @@ public int fonsAddFont (FONScontext* stash, const(char)[] name, const(char)[] pa
|
||||||
}
|
}
|
||||||
// either no such font, or different path
|
// either no such font, or different path
|
||||||
//{ import core.stdc.stdio; printf("trying font [%.*s] from file [%.*s]\n", cast(uint)blen, fontnamebuf.ptr, cast(uint)path.length, path.ptr); }
|
//{ import core.stdc.stdio; printf("trying font [%.*s] from file [%.*s]\n", cast(uint)blen, fontnamebuf.ptr, cast(uint)path.length, path.ptr); }
|
||||||
|
int xres = FONS_INVALID;
|
||||||
try {
|
try {
|
||||||
import core.stdc.stdlib : free, malloc;
|
import core.stdc.stdlib : free, malloc;
|
||||||
static if (NanoVegaHasIVVFS) {
|
static if (NanoVegaHasIVVFS) {
|
||||||
|
|
@ -9202,18 +9203,17 @@ public int fonsAddFont (FONScontext* stash, const(char)[] name, const(char)[] pa
|
||||||
// create font data
|
// create font data
|
||||||
FONSfontData* fdata = fons__createFontData(data, cast(int)dataSize, true); // free data
|
FONSfontData* fdata = fons__createFontData(data, cast(int)dataSize, true); // free data
|
||||||
fdata.incref();
|
fdata.incref();
|
||||||
auto xres = fonsAddFontWithData(stash, name, fdata, defAA);
|
xres = fonsAddFontWithData(stash, name, fdata, defAA);
|
||||||
if (xres == FONS_INVALID) {
|
if (xres == FONS_INVALID) {
|
||||||
fdata.decref(); // this will free [data] and [fdata]
|
fdata.decref(); // this will free [data] and [fdata]
|
||||||
} else {
|
} else {
|
||||||
// remember path
|
// remember path
|
||||||
stash.fonts[xres].setPath(path);
|
stash.fonts[xres].setPath(path);
|
||||||
}
|
}
|
||||||
return xres;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// oops; sorry
|
// oops; sorry
|
||||||
}
|
}
|
||||||
//return FONS_INVALID;
|
return xres;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first try direct path
|
// first try direct path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue