Skip to content

Instantly share code, notes, and snippets.

@PilzAdam
Created August 4, 2013 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PilzAdam/6151023 to your computer and use it in GitHub Desktop.
Save PilzAdam/6151023 to your computer and use it in GitHub Desktop.
diff --git a/fonts/fontdejavusansmono.png b/fonts/fontdejavusansmono.png
new file mode 100644
index 0000000..02ad413
Binary files /dev/null and b/fonts/fontdejavusansmono.png differ
diff --git a/fonts/fontlucida.png b/fonts/fontlucida.png
new file mode 100644
index 0000000..ab7bb70
Binary files /dev/null and b/fonts/fontlucida.png differ
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 33adf10..c07185b 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -141,9 +141,17 @@ void set_default_settings(Settings *settings)
settings->setDefault("server_name", "");
settings->setDefault("server_description", "");
+#if USE_FREETYPE
settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "liberationsans.ttf"));
+#else
+ settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "fontlucida.png"));
+#endif
settings->setDefault("font_size", "13");
+#if USE_FREETYPE
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf"));
+#else
+ settings->setDefault("mono_font_path", porting::getDataPath("textures" DIR_DELIM "fontdejavusansmono.png"));
+#endif
settings->setDefault("mono_font_size", "13");
// Server stuff
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index daec18e..8c2e36f 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -94,13 +94,12 @@ inline u32 clamp_u8(s32 value)
// load the font
// FIXME should a custom texture_path be searched too?
- #if USE_FREETYPE
std::string font_name = g_settings->get("mono_font_path");
+ #if USE_FREETYPE
u16 font_size = g_settings->getU16("mono_font_size");
m_font = gui::CGUITTFont::createTTFont(env, font_name.c_str(), font_size);
#else
- std::string font_name = "fontdejavusansmono.png";
- m_font = env->getFont(getTexturePath(font_name).c_str());
+ m_font = env->getFont(font_name.c_str());
#endif
if (m_font == NULL)
{
diff --git a/src/main.cpp b/src/main.cpp
index b3aa9c9..3bea933 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1388,12 +1388,12 @@ int main(int argc, char *argv[])
guienv = device->getGUIEnvironment();
gui::IGUISkin* skin = guienv->getSkin();
- #if USE_FREETYPE
std::string font_path = g_settings->get("font_path");
+ #if USE_FREETYPE
u16 font_size = g_settings->getU16("font_size");
gui::IGUIFont *font = gui::CGUITTFont::createTTFont(guienv, font_path.c_str(), font_size);
#else
- gui::IGUIFont* font = guienv->getFont(getTexturePath("fontlucida.png").c_str());
+ gui::IGUIFont* font = guienv->getFont(font_path.c_str());
#endif
if(font)
skin->setFont(font);
diff --git a/textures/base/pack/fontdejavusansmono.png b/textures/base/pack/fontdejavusansmono.png
deleted file mode 100644
index 02ad413..0000000
Binary files a/textures/base/pack/fontdejavusansmono.png and /dev/null differ
diff --git a/textures/base/pack/fontlucida.png b/textures/base/pack/fontlucida.png
deleted file mode 100644
index ab7bb70..0000000
Binary files a/textures/base/pack/fontlucida.png and /dev/null differ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment