Skip to content

Commit

Permalink
macOS|Client: Changed the UI font
Browse files Browse the repository at this point in the history
More consistent and compatible with macOS 10.15.
  • Loading branch information
skyjake committed Oct 12, 2019
1 parent 3de60a8 commit 5c48ce6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
Expand Up @@ -13,11 +13,7 @@ script {
def loadFonts()
import App
fontDir = __file__.fileNamePath() / "fonts"
fontStyles = ['Regular', 'Bold', 'Italic', 'BoldItalic']
# Light fonts are a bit too thin for low-res displays.
if DisplayMode.PIXEL_RATIO > 1
fontStyles += ['Light', 'LightItalic']
end
fontStyles = ['Regular', 'Bold', 'Italic', 'BoldItalic', 'Light', 'LightItalic']
for style in fontStyles
App.loadFont(fontDir / ("SourceSansPro-%s.ttf" % style))
end
Expand Down Expand Up @@ -46,29 +42,10 @@ group {
condition: Version.OS == 'macx' or Version.OS == 'ios'

script {
loadFonts()

# Define mappings for native font styles and weights.
import App
if Version.OS == 'macx'
prefix = '.SFNS'
else
prefix = '.SFUI'
end
App.addFontMapping("SF UI Text", {
['regular', 25]: prefix + 'Text-Light',
['regular', 50]: prefix + 'Text-Regular',
['regular', 75]: prefix + 'Text-Bold',
['italic', 25]: prefix + 'Text-LightItalic',
['italic', 50]: prefix + 'Text-Italic',
['italic', 75]: prefix + 'Text-BoldItalic'
})
App.addFontMapping("SF UI Display", {
['regular', 25]: prefix + 'Display-Light',
['regular', 50]: prefix + 'Display-Regular',
['regular', 75]: prefix + 'Display-Bold',
['italic', 25]: prefix + 'Text-LightItalic', # Only non-italic available.
['italic', 50]: prefix + 'Text-Italic',
['italic', 75]: prefix + 'Text-BoldItalic'
})
App.addFontMapping("Menlo", {
['regular', 25]: 'Menlo-Regular',
['regular', 50]: 'Menlo-Regular',
Expand All @@ -80,7 +57,7 @@ group {
}

font default {
family: SF UI Text
family: Source Sans Pro
size $: gui.scale('16pt', DisplayMode.PIXEL_RATIO)
weight: normal
style: normal
Expand Down Expand Up @@ -117,14 +94,6 @@ font heading inherits title {
size $: gui.scale(default.size, 1.2)
}

script {
if Version.OS == 'macx' or Version.OS == 'ios'
# Use the larger variant.
title.family = "SF UI Display"
heading.family = "SF UI Display"
end
}

font small inherits default {
size $: gui.scale(self.size, 0.75)
}
Expand Down
10 changes: 5 additions & 5 deletions doomsday/sdk/libgui/src/text/font.cpp
Expand Up @@ -25,13 +25,13 @@
#include <QPainter>
#include <QThreadStorage>

#if (defined(MACOSX) && defined(MACOS_10_7)) || defined (DENG_IOS)
# include "../src/text/coretextnativefont_macx.h"
namespace de { typedef CoreTextNativeFont PlatformFont; }
#else
//#if (defined(MACOSX) && defined(MACOS_10_7)) || defined (DENG_IOS)
//# include "../src/text/coretextnativefont_macx.h"
//namespace de { typedef CoreTextNativeFont PlatformFont; }
//#else
# include "../src/text/qtnativefont.h"
namespace de { typedef QtNativeFont PlatformFont; }
#endif
//#endif

namespace de {

Expand Down

0 comments on commit 5c48ce6

Please sign in to comment.