From b58d729ca617c3bc8b9f0388f1d55913b1c1ddb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Sat, 1 Jun 2019 18:11:33 +0300 Subject: [PATCH] Default Style|libgui: Font tweaks --- .../defaultstyle.pack/fonts.dei | 52 ++++++++++--------- doomsday/libs/gui/src/text/font.cpp | 9 +++- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/doomsday/apps/client/net.dengine.client.pack/defaultstyle.pack/fonts.dei b/doomsday/apps/client/net.dengine.client.pack/defaultstyle.pack/fonts.dei index 4e620d438f..e75cb40097 100644 --- a/doomsday/apps/client/net.dengine.client.pack/defaultstyle.pack/fonts.dei +++ b/doomsday/apps/client/net.dengine.client.pack/defaultstyle.pack/fonts.dei @@ -29,7 +29,7 @@ script { } group { - condition: Version.OS in ['windows', 'macx'] + condition: Version.OS == 'windows' script { loadFonts() } @@ -42,12 +42,30 @@ group { font monospace inherits default { family: Source Code Pro - size: 10pt + size: 9pt } } group { - condition: False #Version.OS == 'macx' or Version.OS == 'ios' + condition: Version.OS == 'unix' + + script { loadFonts() } + + font default { + family: Source Sans Pro + size $: gui.scale("12pt", DisplayMode.PIXEL_RATIO) + weight: normal + style: normal + } + + font monospace inherits default { + family: Source Code Pro + size $: gui.scale("9pt", DisplayMode.PIXEL_RATIO) + } +} + +group { + condition: Version.OS in ['macx', 'ios'] script { # Define mappings for native font styles and weights. @@ -66,7 +84,7 @@ group { ['italic', 75]: prefix + 'Text-BoldItalic' }) App.addFontMapping("SF UI Display", { - ['regular', 25]: prefix + 'Display-Light', + ['regular', 25]: prefix + 'Display-Thin', ['regular', 50]: prefix + 'Display-Regular', ['regular', 75]: prefix + 'Display-Bold', ['italic', 25]: prefix + 'Text-LightItalic', # Only non-italic available. @@ -96,22 +114,6 @@ group { } } -group { - condition: Version.OS == 'unix' - - font default { - family: Liberation Sans - size $: gui.scale("13pt", DisplayMode.PIXEL_RATIO) - weight: normal - style: normal - } - - font monospace inherits default { - family: FreeMono - size $: gui.scale("9pt", DisplayMode.PIXEL_RATIO) - } -} - font title inherits default { size $: gui.scale(self.size, 1.75) weight: light @@ -122,11 +124,11 @@ font heading inherits title { } script { - #if Version.OS in ['macx', 'ios'] - # # Use the larger variant. - # title.family = "SF UI Display" - # heading.family = "SF UI Display" - #end + if Version.OS in ['macx', 'ios'] + # Use the larger variant. + title.family = "SF UI Display" + heading.family = "SF UI Display" + end } font small inherits default { diff --git a/doomsday/libs/gui/src/text/font.cpp b/doomsday/libs/gui/src/text/font.cpp index 6ce5417b72..0768c31d25 100644 --- a/doomsday/libs/gui/src/text/font.cpp +++ b/doomsday/libs/gui/src/text/font.cpp @@ -22,10 +22,11 @@ #include #include -#if (defined(MACOSX) && defined(MACOS_10_7)) || defined (DENG_IOS) +#if (defined(MACOSX) && defined(MACOS_10_7)) || defined (DE_IOS) # include "../src/text/coretextnativefont_macx.h" namespace de { typedef CoreTextNativeFont PlatformFont; } #else +# define DE_USING_SDL_TTF # include "../src/text/sdlnativefont.h" namespace de { typedef SdlNativeFont PlatformFont; } #endif @@ -424,7 +425,13 @@ Rule const &Font::lineSpacing() const bool Font::load(const Block &data) // static { +#if defined (DE_USING_SDL_TTF) return SdlNativeFont::load(data); +#else + warning("Font::load() is not implemented"); + DE_UNUSED(data); + return false; +#endif } //------------------------------------------------------------------------------------------------