Emscripten: fixed fontconfig font path
This commit is contained in:
@@ -219,10 +219,11 @@ mkdir -p baseset
|
||||
cp -f "icu/source/data/in/icudt68l.dat" ./ || exit 1
|
||||
}
|
||||
|
||||
[ -e fonts ] || {
|
||||
[ -e fonts/fonts.conf ] || {
|
||||
wget -nc https://sourceforge.net/projects/libsdl-android/files/openttd-fonts.zip || exit 1
|
||||
unzip openttd-fonts.zip || exit 1
|
||||
rm openttd-fonts.zip
|
||||
sed 's@/usr/share/fonts@/fonts@g' fontconfig-2.13.1/build-wasm/etc/fonts/fonts.conf > fonts/fonts.conf || exit 1
|
||||
}
|
||||
|
||||
#[ -e TimGM6mb.sf2 ] || {
|
||||
|
||||
@@ -728,12 +728,13 @@ int openttd_main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
#ifndef WIN32
|
||||
// Configure local font path on Android
|
||||
//char curdir[PATH_MAX];
|
||||
//getcwd(curdir, sizeof(curdir));
|
||||
//setenv("FONTCONFIG_FONTS", (std::string(curdir) + "/fonts").c_str(), 1);
|
||||
// Configure local font path on Android, it uses older Fontconfig version that does not require config file
|
||||
setenv("FONTCONFIG_FONTS", "fonts", 1);
|
||||
DEBUG(misc, 1, "Set FONTCONFIG_FONTS to %s", getenv("FONTCONFIG_FONTS"));
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// Fontconfig config file is required on Emscripten, and the path to fonts directory is named differently
|
||||
setenv("FONTCONFIG_FILE", "/fonts/fonts.conf", 1);
|
||||
#endif
|
||||
}
|
||||
/* enumerate language files */
|
||||
|
||||
@@ -133,7 +133,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
|
||||
if (res != FcResultMatch || file == nullptr) {
|
||||
continue;
|
||||
}
|
||||
DEBUG(freetype, 1, "Got font %s", file);
|
||||
DEBUG(freetype, 1, "Found font %s", file);
|
||||
int missing = 0;
|
||||
|
||||
/* Get a font with the right spacing .*/
|
||||
|
||||
@@ -2021,7 +2021,7 @@ int MissingGlyphSearcher::FindMissingGlyphs()
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
DEBUG(freetype, 1, "Font %s is missing glyphs to display char 0x%X '%s' in %s font size", font_name.c_str(), c, char_name, size_name.c_str());
|
||||
//DEBUG(freetype, 1, "Font %s is missing glyphs to display char 0x%X '%s' in %s font size", font_name.c_str(), c, char_name, size_name.c_str());
|
||||
missing++;
|
||||
}
|
||||
}
|
||||
@@ -2118,7 +2118,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
||||
* future, so for safety we just Utf8 Encode it into the string,
|
||||
* which takes exactly three characters, so it replaces the "XXX"
|
||||
* with the colour marker. */
|
||||
#ifndef __ANDROID__
|
||||
#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
|
||||
static char *err_str = stredup("XXXThe current font is missing some of the characters used in the texts for this language. Using system fallback font instead.");
|
||||
Utf8Encode(err_str, SCC_YELLOW);
|
||||
SetDParamStr(0, err_str);
|
||||
|
||||
Reference in New Issue
Block a user