Size for custom font for tab buttons and toggle buttons


#1

Hi all, 

I've been having a really hard time to get all my components use a custom font. I added the font to my binary data, and in my lookandfeel class I overrode all the getXFont() methods I could find: getLabelFont(), getComboBoxFont(), getTextButtonFont() and getMenuBarFont(), which seem to all work.

But the text in my tab buttons and toggle buttons was not using my custom font (and I could not find a getXFont() method for those). So I overrode getTypefaceForFont(), which changed the font, but now the size of the font is totally off (for tab buttons and toggle buttons)...  

I then tried to override drawTabButtonText(), but that didn't change anything. 

How can I change the default font size of tab buttons and toggle buttons? Or is there a more consistent way of setting custom fonts for all components?

Cheers, 

Vincent


#2

I then tried to override drawTabButtonText(), but that didn't change anything. 

If nothing changes then it's not being called! Check that your l+f class really is active for that object?


#3

Finally got it to work. I was effectively not applying my l+f class on my toggle buttons and tabbed component.

For toggle buttons, I had to override drawToggleButton() in my l+f class.

But I had some really strange problems when overriding drawTabButtonText(). At first I got errors from some destructor that getTabButtonOverlap() and getTabButtonSpaceAroundImage() were pure virtual. Then those magically went away, but my drawTabButton() was just not called. What worked was overriding drawTabButton(), and implementing my own createTabTextLayout(), taken from l+fv3.

Perhaps drawTabButtonText() works when your l+f class inherits directly from the base l+f class ?