From f4a1abdb9b11e3e499ba4fb859438be18fd176ff Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 14 Feb 2018 14:39:51 +1100 Subject: [PATCH] Fonts: added script font family --- data/hardwired/fonts.cfg | 1 + src/font/font_config.cpp | 9 +++++++++ src/font/font_options.hpp | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/data/hardwired/fonts.cfg b/data/hardwired/fonts.cfg index 74cc3ea2f2fd..64922b32df71 100644 --- a/data/hardwired/fonts.cfg +++ b/data/hardwired/fonts.cfg @@ -28,6 +28,7 @@ family_order= _ "Lato" family_order_monospace= _ "DejaVu Sans Mono" family_order_light= _ "Lato Light" + family_order_script = _ "Oldania ADF Std" # # Legagy SDL_TTF stuff. diff --git a/src/font/font_config.cpp b/src/font/font_config.cpp index a629acc029e4..04d7cf49d1a0 100644 --- a/src/font/font_config.cpp +++ b/src/font/font_config.cpp @@ -115,6 +115,7 @@ bool is_valid_font_file(const std::string& file) t_string family_order_sans; t_string family_order_mono; t_string family_order_light; +t_string family_order_script; } // end anon namespace @@ -160,6 +161,7 @@ bool load_font_config() family_order_sans = fonts_config["family_order"]; family_order_mono = fonts_config["family_order_monospace"]; family_order_light = fonts_config["family_order_light"]; + family_order_script = fonts_config["family_order_script"]; if(family_order_mono.empty()) { ERR_FT << "No monospace font family order defined, falling back to sans serif order\n"; @@ -171,6 +173,11 @@ bool load_font_config() family_order_light = family_order_sans; } + if(family_order_script.empty()) { + ERR_FT << "No script font family order defined, falling back to sans serif order\n"; + family_order_script = family_order_sans; + } + std::vector fontlist; for(auto font : utils::split(fonts_config["order"])) { @@ -196,6 +203,8 @@ const t_string& get_font_families(family_class fclass) return family_order_mono; case FONT_LIGHT: return family_order_light; + case FONT_SCRIPT: + return family_order_script; default: return family_order_sans; } diff --git a/src/font/font_options.hpp b/src/font/font_options.hpp index 26d0ab001288..de7b6a48d87f 100644 --- a/src/font/font_options.hpp +++ b/src/font/font_options.hpp @@ -26,7 +26,8 @@ enum family_class { FONT_SANS_SERIF, FONT_MONOSPACE, - FONT_LIGHT + FONT_LIGHT, + FONT_SCRIPT, }; inline family_class str_to_family_class(const std::string& str) @@ -35,6 +36,8 @@ inline family_class str_to_family_class(const std::string& str) return FONT_MONOSPACE; } else if(str == "light") { return FONT_LIGHT; + } else if(str == "script") { + return FONT_SCRIPT; } return FONT_SANS_SERIF;