Resize Slider label font when window is resized

I am trying to resize the font of a slider to match the size of the plugin when the plugin is being resized.

I tried overriding getLabelFont in my custom L&F like so:

float fontSize = 50.0f;
Font getLabelFont(Label& label) override
    {
        label.getFont().setHeight(fontSize);
        return label.getFont();
    }
void setFontSize(float size)
    {
        fontSize = size;
    } 

I then call setFontSize(newTextHeight) in PluginEditor’s resized() method.

However, the slider text size is not changing. Any advice?

Maybe just need to call repaint() on the label to force it to redraw?

@HowardAntares unfortunately that did not work

I just needed to set the typeface in my custom L&F instead of using

LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypeface(*text_font);

in PluginEditor.cpp

My default L&F was not the same as my custom L&F.

1 Like