From e20a2a63328d33282272e60ec2604cce25e258cc Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 21 Feb 2019 14:29:30 -0500 Subject: [PATCH] Move LFO to LatoFont Runtime Fonts introduced Lato and runtime font resolution. CLFOGUI still had a hard coded reference to a font. Make that font a runtime resolved global at the SurgeGUI scope and resolve it to lato on mac/win and sans-serif on linux. Partially closes #622 --- src/common/gui/CLFOGui.cpp | 18 ++---------------- src/common/gui/RuntimeFont.h | 1 + src/common/gui/SurgeGUIEditor.cpp | 11 ++++------- src/mac/RuntimeFontMac.cpp | 3 ++- src/windows/RuntimeFontWin.cpp | 3 ++- 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/common/gui/CLFOGui.cpp b/src/common/gui/CLFOGui.cpp index af5f824d902..fb11730c083 100644 --- a/src/common/gui/CLFOGui.cpp +++ b/src/common/gui/CLFOGui.cpp @@ -9,21 +9,7 @@ using namespace std; extern CFontRef surge_minifont; extern CFontRef surge_patchfont; - -// At a later date, fix this along with the other font issues between platforms. Keep this -// in this unit only. -// See github issue #295. The minifont is 1pt too big so shrink it by 1 px. -// Ideally we would shift all fonts to a bundled lato but that requires us -// to resolve github issue #214 -#if MAC -SharedPointer lfoLabelFont = new CFontDesc("Lucida Grande", 8); // one smaller than minifont -#elif LINUX -SharedPointer lfoLabelFont = new CFontDesc("sans-serif", 8); -#else -SharedPointer lfoLabelFont = new CFontDesc("Microsoft Sans Serif", 8); -#endif - -CFontRef surge_lfoLabelFont = lfoLabelFont; +extern CFontRef surge_lfofont; void drawtri(CRect r, CDrawContext* context, int orientation) { @@ -320,7 +306,7 @@ void CLFOGui::draw(CDrawContext* dc) CColor cselected = {0xfe, 0x98, 0x15, 0xff}; // CColor blackColor (0, 0, 0, 0); dc->setFrameColor(cskugga); - dc->setFont(surge_lfoLabelFont); + dc->setFont(surge_lfofont); rect_shapes = leftpanel; for (int i = 0; i < n_lfoshapes; i++) diff --git a/src/common/gui/RuntimeFont.h b/src/common/gui/RuntimeFont.h index 6af8855a693..aaf2afb4ffb 100644 --- a/src/common/gui/RuntimeFont.h +++ b/src/common/gui/RuntimeFont.h @@ -31,3 +31,4 @@ void initializeRuntimeFont(); */ extern VSTGUI::CFontRef surge_minifont; extern VSTGUI::CFontRef surge_patchfont; +extern VSTGUI::CFontRef surge_lfofont; diff --git a/src/common/gui/SurgeGUIEditor.cpp b/src/common/gui/SurgeGUIEditor.cpp index 314a12666a3..c0d22f8a784 100644 --- a/src/common/gui/SurgeGUIEditor.cpp +++ b/src/common/gui/SurgeGUIEditor.cpp @@ -51,21 +51,18 @@ using namespace std; #if USE_RUNTIME_LOADED_FONTS CFontRef surge_minifont = NULL; CFontRef surge_patchfont = NULL; +CFontRef surge_lfofont = NULL; #else -#if MAC -SharedPointer minifont = new CFontDesc("Lucida Grande", 9); -SharedPointer patchfont = new CFontDesc("Lucida Grande", 14); -#elif LINUX +#if LINUX SharedPointer minifont = new CFontDesc("sans-serif", 9); SharedPointer patchfont = new CFontDesc("sans-serif", 14); -#else -SharedPointer minifont = new CFontDesc("Microsoft Sans Serif", 9); -SharedPointer patchfont = new CFontDesc("Arial", 14); +SharedPointer lfofont = new CFontDesc("sans-serif", 8); #endif CFontRef surge_minifont = minifont; CFontRef surge_patchfont = patchfont; +CFontRef surge_lfofont = lfofont; #endif diff --git a/src/mac/RuntimeFontMac.cpp b/src/mac/RuntimeFontMac.cpp index aa2249ef93f..ebb3df49ebe 100644 --- a/src/mac/RuntimeFontMac.cpp +++ b/src/mac/RuntimeFontMac.cpp @@ -37,9 +37,10 @@ void initializeRuntimeFont() VSTGUI::SharedPointer minifont = new VSTGUI::CFontDesc("Lato", 9); VSTGUI::SharedPointer patchfont = new VSTGUI::CFontDesc("Lato", 14); + VSTGUI::SharedPointer lfofont = new VSTGUI::CFontDesc("Lato", 8); surge_minifont = minifont; surge_patchfont = patchfont; - + surge_lfofont = lfofont; } } diff --git a/src/windows/RuntimeFontWin.cpp b/src/windows/RuntimeFontWin.cpp index fe4e5deb96f..59a6fd6887f 100644 --- a/src/windows/RuntimeFontWin.cpp +++ b/src/windows/RuntimeFontWin.cpp @@ -102,9 +102,10 @@ void initializeRuntimeFont() */ VSTGUI::SharedPointer minifont = new VSTGUI::CFontDesc("Lato", 9); VSTGUI::SharedPointer patchfont = new VSTGUI::CFontDesc("Lato", 14); + VSTGUI::SharedPointer lfofont = new VSTGUI::CFontDesc("Lato", 8); surge_minifont = minifont; surge_patchfont = patchfont; - + surge_lfofont = lfofont; } }