Skip to content

Commit

Permalink
Move LFO to LatoFont
Browse files Browse the repository at this point in the history
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 surge-synthesizer#622
  • Loading branch information
baconpaul committed Feb 23, 2019
1 parent b888368 commit e20a2a6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
18 changes: 2 additions & 16 deletions src/common/gui/CLFOGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CFontDesc> lfoLabelFont = new CFontDesc("Lucida Grande", 8); // one smaller than minifont
#elif LINUX
SharedPointer<CFontDesc> lfoLabelFont = new CFontDesc("sans-serif", 8);
#else
SharedPointer<CFontDesc> lfoLabelFont = new CFontDesc("Microsoft Sans Serif", 8);
#endif

CFontRef surge_lfoLabelFont = lfoLabelFont;
extern CFontRef surge_lfofont;

void drawtri(CRect r, CDrawContext* context, int orientation)
{
Expand Down Expand Up @@ -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++)
Expand Down
1 change: 1 addition & 0 deletions src/common/gui/RuntimeFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ void initializeRuntimeFont();
*/
extern VSTGUI::CFontRef surge_minifont;
extern VSTGUI::CFontRef surge_patchfont;
extern VSTGUI::CFontRef surge_lfofont;
11 changes: 4 additions & 7 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CFontDesc> minifont = new CFontDesc("Lucida Grande", 9);
SharedPointer<CFontDesc> patchfont = new CFontDesc("Lucida Grande", 14);
#elif LINUX
#if LINUX
SharedPointer<CFontDesc> minifont = new CFontDesc("sans-serif", 9);
SharedPointer<CFontDesc> patchfont = new CFontDesc("sans-serif", 14);
#else
SharedPointer<CFontDesc> minifont = new CFontDesc("Microsoft Sans Serif", 9);
SharedPointer<CFontDesc> patchfont = new CFontDesc("Arial", 14);
SharedPointer<CFontDesc> lfofont = new CFontDesc("sans-serif", 8);
#endif

CFontRef surge_minifont = minifont;
CFontRef surge_patchfont = patchfont;
CFontRef surge_lfofont = lfofont;
#endif


Expand Down
3 changes: 2 additions & 1 deletion src/mac/RuntimeFontMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ void initializeRuntimeFont()

VSTGUI::SharedPointer<VSTGUI::CFontDesc> minifont = new VSTGUI::CFontDesc("Lato", 9);
VSTGUI::SharedPointer<VSTGUI::CFontDesc> patchfont = new VSTGUI::CFontDesc("Lato", 14);
VSTGUI::SharedPointer<VSTGUI::CFontDesc> lfofont = new VSTGUI::CFontDesc("Lato", 8);
surge_minifont = minifont;
surge_patchfont = patchfont;

surge_lfofont = lfofont;
}

}
Expand Down
3 changes: 2 additions & 1 deletion src/windows/RuntimeFontWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ void initializeRuntimeFont()
*/
VSTGUI::SharedPointer<VSTGUI::CFontDesc> minifont = new VSTGUI::CFontDesc("Lato", 9);
VSTGUI::SharedPointer<VSTGUI::CFontDesc> patchfont = new VSTGUI::CFontDesc("Lato", 14);
VSTGUI::SharedPointer<VSTGUI::CFontDesc> lfofont = new VSTGUI::CFontDesc("Lato", 8);
surge_minifont = minifont;
surge_patchfont = patchfont;

surge_lfofont = lfofont;
}

}
Expand Down

0 comments on commit e20a2a6

Please sign in to comment.