Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Default Style|libgui: Font tweaks
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent b91fe4d commit b58d729
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
Expand Up @@ -29,7 +29,7 @@ script {
}

group {
condition: Version.OS in ['windows', 'macx']
condition: Version.OS == 'windows'

script { loadFonts() }

Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion doomsday/libs/gui/src/text/font.cpp
Expand Up @@ -22,10 +22,11 @@
#include <de/Hash>
#include <de/ThreadLocal>

#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
Expand Down Expand Up @@ -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
}

//------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit b58d729

Please sign in to comment.