Changing Font and Font Sizes of Buttons and TextEditors?


#1

Is this possible? I dont see options inside of the Projucer to do this and I don’t see any methods inside of the TextEditor and Button classes. Any simple ways to change Font Size, Font Color, and Fonts of TextEditors and Buttons? I’m making a simple BPM app and I’d really like to ramp up the size of those fonts, as they are really small on iOS. I will also change the background color of the textEditors to the same background color so that the numbers don’t look boxed in and appear to “float.”


#2

TextEditor has a setFont() method that you can use to change the font family and size - just create a Font object with the attributes you want and pass that to this method. As for button fonts, you need to override the getTextButtonFont() method in your LookAndFeel to return the font that you want.

Ed


#3

Thanks a ton ed95! I was able to finally change the size of the text in textEditors, which is awesome! Looks like the button text might be a little more difficult, as it might be a tad bit beyond the scope of my knowledge (I’ve never overridden a function before, I have overloaded, but not overridden), so I’ll have to do some studying up on that. Thank you very much! Very helpful post.


#4

No problem. If you want to see an example of how to do a custom LookAndFeel take a look at the LookAndFeelDemo.cpp file in the JUCE Demo project (JUCE/examples/Demo). You’ll want to override the getTextButtonFont() method in yours to return a custom Font.

Ed


#5

Thanks a ton Ed. I’ll be looking into this tomorrow. Here’s an update on my GUI. Its still not super professional, but its way better than before. This is my first real attempt at making the GUI look somewhat presentable (this is the second iOS app I’ve made).

PS - I know its cheesy to have my name on the app, but its only there as I’m making this for my portfolio, not as a downloadable app. If I ever released it, I would strip my name off it.