Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On windows, use OS Lato if available #5012

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/installer_win/surge-x86.iss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Name: Data; Description: Data Files; Types: full compact custom; Flags: fixed

[Files]
Source: {#SURGE_SRC}\resources\data\*; DestDir: {commonappdata}\Surge XT\; Components: Data; Flags: recursesubdirs; Excludes: "*.git,windows.wt,configuration.xml,paramdocumentation.xml";

Source: {#SURGE_SRC}\resources\fonts\Lato-Regular.ttf; DestDir: "{fonts}"; Components: Data; FontInstall: "Lato"; Flags: onlyifdoesntexist uninsneveruninstall
;; these lines are used by Azure pipelines - if you want to build the installer locally, comment them out!
Source: {#SURGE_BIN}\surge_xt_products\Surge XT (32-bit).vst3\*; DestDir: {commoncf32}\VST3\Surge Synth Team\; Components: VST3; Flags: ignoreversion recursesubdirs
Source: {#SURGE_BIN}\surge_xt_products\Surge XT Effects (32-bit).vst3\*; DestDir: {commoncf32}\VST3\Surge Synth Team\; Components: EffectsVST3; Flags: ignoreversion skipifsourcedoesntexist recursesubdirs
Expand Down
1 change: 1 addition & 0 deletions scripts/installer_win/surge.iss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Name: Data; Description: Data Files; Types: full compact custom; Flags: fixed

[Files]
Source: {#SURGE_SRC}\resources\data\*; DestDir: {commonappdata}\Surge XT\; Components: Data; Flags: recursesubdirs; Excludes: "*.git,windows.wt,configuration.xml,paramdocumentation.xml";
Source: {#SURGE_SRC}\resources\fonts\Lato-Regular.ttf; DestDir: "{fonts}"; Components: Data; FontInstall: "Lato"; Flags: onlyifdoesntexist uninsneveruninstall
Source: {#SURGE_BIN}\surge_xt_products\Surge XT.vst3\*; DestDir: {commoncf64}\VST3\Surge Synth Team\; Components: VST3; Flags: ignoreversion recursesubdirs
Source: {#SURGE_BIN}\surge_xt_products\Surge XT Effects.vst3\*; DestDir: {commoncf64}\VST3\Surge Synth Team\; Components: EffectsVST3; Flags: ignoreversion skipifsourcedoesntexist recursesubdirs
Source: {#SURGE_BIN}\surge_xt_products\Surge XT.exe; DestDir: {commonpf64}\Surge Synth Team\; Components: SA; Flags: ignoreversion
Expand Down
20 changes: 19 additions & 1 deletion src/gui/RuntimeFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ namespace GUI

DefaultFonts::DefaultFonts()
{
#if WINDOWS
/* On windows in memory fonts use GDI and OS fonts use D2D so if we have
* LATO in the OS use that
*/
auto ft = juce::Font::findAllTypefaceNames();
for (const auto &q : ft)
if (q == "Lato")
useOSLato = true;

#endif

#define TEST_WITH_INDIE_FLOWER 0
#if TEST_WITH_INDIE_FLOWER
latoRegularTypeface = juce::Typeface::createSystemTypefaceFor(
Expand All @@ -46,7 +57,14 @@ DefaultFonts::~DefaultFonts(){};

juce::Font DefaultFonts::getLatoAtSize(float size, juce::Font::FontStyleFlags style) const
{
return juce::Font(latoRegularTypeface).withPointHeight(size).withStyle(style);
if (useOSLato)
{
return juce::Font("Lato", 10, 0).withPointHeight(size).withStyle(style);
}
else
{
return juce::Font(latoRegularTypeface).withPointHeight(size).withStyle(style);
}
}

juce::Font DefaultFonts::getFiraMonoAtSize(float size) const
Expand Down
2 changes: 2 additions & 0 deletions src/gui/RuntimeFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ struct DefaultFonts : public juce::DeletedAtShutdown
juce::Font::FontStyleFlags style = juce::Font::FontStyleFlags::plain) const;
juce::Font getFiraMonoAtSize(float size) const;

bool useOSLato{false};

juce::Font displayFont;
juce::Font patchNameFont;
juce::Font lfoTypeFont;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/ModulatableSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void ModulatableSlider::updateLocationState()
// This calculation is a little dicey but is correct
labelRect = juce::Rectangle<int>()
.withX(handleX0)
.withY(trayh / 2)
.withY(trayh / 2 + 1)
.withHeight(trayh)
.withWidth(range)
.withTrimmedRight(1)
Expand Down