Skip to content

Commit

Permalink
Fix a FontSize Slider problem; introduce a font test
Browse files Browse the repository at this point in the history
1. Fix a problem with font size on sliders
2. Introduce a test font, credited in the README-IndieFlower.txt,
   and have a compile time flag to swap to it to make sure we are
   using font api consistently
  • Loading branch information
baconpaul committed Apr 23, 2021
1 parent 99fadd4 commit 46e618e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ if( BUILD_SURGE_XT )
file(GLOB SURGE_SYNTH_JUCE_RESOURCES_GLOB
assets/SurgeClassic/exported/*svg
resources/fonts/Lato*ttf
resources/fonts/IndieFlower.ttf
)

juce_add_binary_data( surge-xt-binary
Expand Down
Binary file added resources/fonts/IndieFlower.ttf
Binary file not shown.
2 changes: 2 additions & 0 deletions resources/fonts/README-IndieFlower.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IndieFlower is an OFL font from https://fontlibrary.org/en/font/indie-flower
authored by Kimberly Geswein. We use it here for testing purposes.
3 changes: 2 additions & 1 deletion src/common/gui/CSurgeSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ void CSurgeSlider::draw(CDrawContext *dc)
}

labfont.setStyleFlags(font_style);
labfont.setHeight(font_size);
if (font_size != labfont.getHeightInPoints())
labfont = labfont.withPointHeight(font_size);

CRect size = getViewSize();

Expand Down
6 changes: 6 additions & 0 deletions src/common/gui/RuntimeFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ namespace GUI

DefaultFonts::DefaultFonts()
{
#define TEST_WITH_INDIE_FLOWER 0
#if TEST_WITH_INDIE_FLOWER
latoRegularTypeface = juce::Typeface::createSystemTypefaceFor(BinaryData::IndieFlower_ttf,
BinaryData::IndieFlower_ttfSize);
#else
latoRegularTypeface = juce::Typeface::createSystemTypefaceFor(BinaryData::LatoRegular_ttf,
BinaryData::LatoRegular_ttfSize);
#endif

displayFont = getLatoAtSize(9);
patchNameFont = getLatoAtSize(13);
Expand Down

0 comments on commit 46e618e

Please sign in to comment.