From 72416a6a1f75d56abfad0f486e57fd32579b3604 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Tue, 10 Sep 2019 15:11:26 +0200 Subject: [PATCH] Formspec: add hypertext element --- builtin/settingtypes.txt | 38 +- doc/lua_api.txt | 112 ++- fonts/Arimo-Bold.ttf | Bin 0 -> 420920 bytes fonts/Arimo-BoldItalic.ttf | Bin 0 -> 417668 bytes fonts/Arimo-Italic.ttf | Bin 0 -> 421372 bytes fonts/Cousine-Bold.ttf | Bin 0 -> 288272 bytes fonts/Cousine-BoldItalic.ttf | Bin 0 -> 265104 bytes fonts/Cousine-Italic.ttf | Bin 0 -> 262524 bytes src/client/fontengine.cpp | 70 +- src/client/fontengine.h | 61 +- src/client/hud.cpp | 70 +- src/client/hud.h | 12 + src/defaultsettings.cpp | 8 + src/gui/CMakeLists.txt | 1 + src/gui/guiFormSpecMenu.cpp | 91 +- src/gui/guiFormSpecMenu.h | 2 + src/gui/guiHyperText.cpp | 1137 ++++++++++++++++++++++++ src/gui/guiHyperText.h | 229 +++++ src/irrlicht_changes/CGUITTFont.h | 2 + src/util/string.cpp | 25 + src/util/string.h | 11 + util/travis/clang-format-whitelist.txt | 2 + 22 files changed, 1792 insertions(+), 79 deletions(-) create mode 100644 fonts/Arimo-Bold.ttf create mode 100644 fonts/Arimo-BoldItalic.ttf create mode 100644 fonts/Arimo-Italic.ttf create mode 100644 fonts/Cousine-Bold.ttf create mode 100644 fonts/Cousine-BoldItalic.ttf create mode 100644 fonts/Cousine-Italic.ttf create mode 100644 src/gui/guiHyperText.cpp create mode 100644 src/gui/guiHyperText.h diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 5669519de..e74b8ea8b 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -851,14 +851,9 @@ tooltip_append_itemname (Append item name) bool false # If disabled, bitmap and XML vectors fonts are used instead. freetype (FreeType fonts) bool true -# Path to the default font. -# If “freetype” setting is enabled: Must be a TrueType font. -# If “freetype” setting is disabled: Must be a bitmap or XML vectors font. -# The fallback font will be used if the font cannot be loaded. -font_path (Font path) filepath fonts/liberationsans.ttf +font_bold (Font bold by default) bool false -# Font size of the default font in point (pt). -font_size (Font size) int 16 1 +font_italic (Font italic by default) bool false # Shadow offset (in pixels) of the default font. If 0, then shadow will not be drawn. font_shadow (Font shadow) int 1 @@ -866,20 +861,31 @@ font_shadow (Font shadow) int 1 # Opaqueness (alpha) of the shadow behind the default font, between 0 and 255. font_shadow_alpha (Font shadow alpha) int 127 0 255 -# Path to the monospace font. +# Font size of the default font in point (pt). +font_size (Font size) int 16 1 + +# Path to the default font. # If “freetype” setting is enabled: Must be a TrueType font. # If “freetype” setting is disabled: Must be a bitmap or XML vectors font. -# This font is used for e.g. the console and profiler screen. -mono_font_path (Monospace font path) filepath fonts/liberationmono.ttf +# The fallback font will be used if the font cannot be loaded. +font_path (Regular font path) filepath fonts/Arimo-Regular.ttf + +font_path_bold (Bold font path) filepath fonts/Arimo-Bold.ttf +font_path_italic (Italic font path) filepath fonts/Arimo-Italic.ttf +font_path_bolditalic (Bold and italic font path) filepath fonts/Arimo-BoldItalic.ttf # Font size of the monospace font in point (pt). mono_font_size (Monospace font size) int 15 1 -# Path of the fallback font. +# Path to the monospace font. # If “freetype” setting is enabled: Must be a TrueType font. # If “freetype” setting is disabled: Must be a bitmap or XML vectors font. -# This font will be used for certain languages or if the default font is unavailable. -fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf +# This font is used for e.g. the console and profiler screen. +mono_font_path (Monospace font path) filepath fonts/Cousine-Regular.ttf + +mono_font_path_bold (Bold monospace font path) filepath fonts/Cousine-Bold.ttf +mono_font_path_italic (Italic monospace font path) filepath fonts/Cousine-Italic.ttf +mono_font_path_bolditalic (Bold and italic monospace font path) filepath fonts/Cousine-BoldItalic.ttf # Font size of the fallback font in point (pt). fallback_font_size (Fallback font size) int 15 1 @@ -890,6 +896,12 @@ fallback_font_shadow (Fallback font shadow) int 1 # Opaqueness (alpha) of the shadow behind the fallback font, between 0 and 255. fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255 +# Path of the fallback font. +# If “freetype” setting is enabled: Must be a TrueType font. +# If “freetype” setting is disabled: Must be a bitmap or XML vectors font. +# This font will be used for certain languages or if the default font is unavailable. +fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf + # Path to save screenshots at. screenshot_path (Screenshot folder) path diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 5640be73c..1905eff44 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2189,8 +2189,13 @@ Elements half a coordinate. With the old system, newlines are spaced 2/5 of an inventory slot. -### `vertlabel[,;