Resize Slider label font when window is resized

sure! :slight_smile: sorry I wasn’t clear when I first wrote this

you can either do

auto theFont = juce::Font("Arial", "Regular", proportionOfWidth(0.03125f));
g.setFont(theFont);

or

g.setFont(juce::Font("Arial", "Regular", proportionOfWidth(0.03125f)));

This is a pretty easy, on the fly font change.
However, since writing that comment four months ago, I’ve since changed over to putting it in my default look and feel as based on this tutorial:

as I am using my own ttf font that I created. I wrote it as

const juce::Font OtherLookAndFeel::getCustomFont()
{
    /* Importing binary of custom font */
    static auto typeface = juce::Typeface::createSystemTypefaceFor(BinaryData::amiDOS_ttf, BinaryData::amiDOS_ttfSize);
    return juce::Font(typeface);
}

juce::Typeface::Ptr OtherLookAndFeel::getTypefaceForFont(const juce::Font& f)
{
    /* Returning font typeface */
    return getCustomFont().getTypeface();
}

in my LookAndFeel’s .cpp file.
If you have your custom LnF component set as your default LnF, you can change the height by calling it in the component by writing in paint:

auto theFont = g.getCurrentFont();
theFont.setHeight(proportionOfWidth(0.03125f));
g.setFont(theFont));

Hope this is more help than my last comment! Sorry again for not typing it out well last time :slight_smile:

1 Like