aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlya Zhuravlev <zhuravlevilya@ya.ru>2013-09-07 20:06:00 +0400
committerIlya Zhuravlev <zhuravlevilya@ya.ru>2013-09-08 15:16:19 +0400
commit6de16bb43890a86e82c9465a0582159a855c7422 (patch)
tree57fbcb00d009e95acff2d20264ceaf8f610ec964 /src
parent6291fd1cbb9c2808e336532c833e26330ff2642b (diff)
downloadminetest-6de16bb43890a86e82c9465a0582159a855c7422.tar.gz
minetest-6de16bb43890a86e82c9465a0582159a855c7422.tar.bz2
minetest-6de16bb43890a86e82c9465a0582159a855c7422.zip
Add fallback font support for some languages.
Diffstat (limited to 'src')
-rw-r--r--src/defaultsettings.cpp4
-rw-r--r--src/main.cpp20
2 files changed, 22 insertions, 2 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 9e27c79cd..373a74746 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -147,6 +147,8 @@ void set_default_settings(Settings *settings)
settings->setDefault("font_size", "13");
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf"));
settings->setDefault("mono_font_size", "13");
+ settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf"));
+ settings->setDefault("fallback_font_size", "13");
#else
settings->setDefault("freetype", "false");
settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "fontlucida.png"));
@@ -281,6 +283,8 @@ void set_default_settings(Settings *settings)
settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/");
settings->setDefault("high_precision_fpu", "true");
+
+ settings->setDefault("language", "");
}
void override_default_settings(Settings *settings, Settings *from)
diff --git a/src/main.cpp b/src/main.cpp
index 940580b7a..fafb3c8ef 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -995,7 +995,19 @@ int main(int argc, char *argv[])
{
run_tests();
}
-
+
+ std::string language = g_settings->get("language");
+ if (language.length()) {
+#ifndef _WIN32
+ setenv("LANGUAGE", language.c_str(), 1);
+#else
+ char *lang_str = (char*)calloc(10 + language.length(), sizeof(char));
+ strcat(lang_str, "LANGUAGE=");
+ strcat(lang_str, language.c_str());
+ putenv(lang_str);
+#endif
+ }
+
/*
Game parameters
*/
@@ -1396,7 +1408,11 @@ int main(int argc, char *argv[])
bool use_freetype = g_settings->getBool("freetype");
#if USE_FREETYPE
if (use_freetype) {
- u16 font_size = g_settings->getU16("font_size");
+ std::string fallback;
+ if (is_yes(gettext("needs_fallback_font")))
+ fallback = "fallback_";
+ u16 font_size = g_settings->getU16(fallback + "font_size");
+ font_path = g_settings->get(fallback + "font_path");
font = gui::CGUITTFont::createTTFont(guienv, font_path.c_str(), font_size);
} else {
font = guienv->getFont(font_path.c_str());