Can't change Editor Font size AND typeface

Hi, I realise this should be a straight forward thing to do.
I’m popping up a simple TextEditor for people to input numbers.

Unfortunately I can’t set my own font and then set it’s size.
That’s because changing the size sets the old font back, which looks out of place.

So I can’t do this:

numberInput->setFont(myFont);
numberInput->setFont(48.0f);

Because the second statement switches back to the old font.
If I swap them around the font will be selected, but it won’t reflect the size.
This is kinda frustrating.

I’ve tried searching though the look and feel functions, but I haven’t found the cause or the cure for this yet.
Does anybody know if I can actually use a different font in a text editor AND change its size?

The second call implicitly creates a new juce::Font object using this ctor: Font (float fontHeight, int styleFlags = plain);

I’m not sure what type myFont is, but I suspect also juce::Font? Then you can use ...setFont(myFont.withHeight(48.0f)); This call does not change the object myFont but returns a copy with the specified size.

1 Like

That did it, Rincewind! Thank-you so much. Especially for the quick reply, this forum is great sometimes.