mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-22 07:38:48 -05:00
Add fallback font support for some languages.
This commit is contained in:
parent
6291fd1cbb
commit
6de16bb438
20
README.txt
20
README.txt
@ -382,17 +382,31 @@ DejaVu Sans Mono:
|
|||||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
||||||
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
||||||
|
|
||||||
Bitstream Vera Fonts Copyright:
|
Bitstream Vera Fonts Copyright:
|
||||||
|
|
||||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
||||||
a trademark of Bitstream, Inc.
|
a trademark of Bitstream, Inc.
|
||||||
|
|
||||||
Arev Fonts Copyright:
|
Arev Fonts Copyright:
|
||||||
|
|
||||||
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
||||||
|
|
||||||
Liberation Fonts Copyright:
|
Liberation Fonts Copyright:
|
||||||
|
|
||||||
Copyright (c) 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
|
Copyright (c) 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
|
||||||
|
|
||||||
|
DroidSansFallback:
|
||||||
|
|
||||||
|
Copyright (C) 2008 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
BIN
fonts/DroidSansFallbackFull.ttf
Normal file
BIN
fonts/DroidSansFallbackFull.ttf
Normal file
Binary file not shown.
@ -191,6 +191,10 @@
|
|||||||
#mono_font_path = fonts/liberationmono.ttf
|
#mono_font_path = fonts/liberationmono.ttf
|
||||||
#mono_font_size = 13
|
#mono_font_size = 13
|
||||||
|
|
||||||
|
# This font will be used for certain languages
|
||||||
|
#fallback_font_path = fonts/DroidSansFallbackFull.ttf
|
||||||
|
#fallback_font_size = 13
|
||||||
|
|
||||||
#
|
#
|
||||||
# Server stuff
|
# Server stuff
|
||||||
#
|
#
|
||||||
@ -390,3 +394,7 @@
|
|||||||
|
|
||||||
# Makes DirectX work with LuaJIT. Disable if it causes troubles.
|
# Makes DirectX work with LuaJIT. Disable if it causes troubles.
|
||||||
#high_precision_fpu = true
|
#high_precision_fpu = true
|
||||||
|
|
||||||
|
# Override language. When no value is provided (default) system language is used.
|
||||||
|
# Check "locale" directory for the list of available translations.
|
||||||
|
#language =
|
||||||
|
@ -147,6 +147,8 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("font_size", "13");
|
settings->setDefault("font_size", "13");
|
||||||
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf"));
|
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf"));
|
||||||
settings->setDefault("mono_font_size", "13");
|
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
|
#else
|
||||||
settings->setDefault("freetype", "false");
|
settings->setDefault("freetype", "false");
|
||||||
settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "fontlucida.png"));
|
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("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/");
|
||||||
|
|
||||||
settings->setDefault("high_precision_fpu", "true");
|
settings->setDefault("high_precision_fpu", "true");
|
||||||
|
|
||||||
|
settings->setDefault("language", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void override_default_settings(Settings *settings, Settings *from)
|
void override_default_settings(Settings *settings, Settings *from)
|
||||||
|
18
src/main.cpp
18
src/main.cpp
@ -996,6 +996,18 @@ int main(int argc, char *argv[])
|
|||||||
run_tests();
|
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
|
Game parameters
|
||||||
*/
|
*/
|
||||||
@ -1396,7 +1408,11 @@ int main(int argc, char *argv[])
|
|||||||
bool use_freetype = g_settings->getBool("freetype");
|
bool use_freetype = g_settings->getBool("freetype");
|
||||||
#if USE_FREETYPE
|
#if USE_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);
|
font = gui::CGUITTFont::createTTFont(guienv, font_path.c_str(), font_size);
|
||||||
} else {
|
} else {
|
||||||
font = guienv->getFont(font_path.c_str());
|
font = guienv->getFont(font_path.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user