Bug? TabbedButtonBar ignores font.setHorizontalScale()

JUCE 6.0.7. Mac. I’m trying to set a global HorizontalScale for all of the fonts in my application. I’ve been able to make this work everywhere except the TabbedButtonBar. It simply ignores any change to font.setHorizontalScale().

For example, I override createTabTextLayout() in my LookAndFeel. If I change the kerning on the font, or set it to bold, or change the font height, it works. But any change to the HorizontalScale is completely ineffectual. This is the override, copied from LookAndFeel_V3. I added only two lines here for demonstration purposes; one to change the kerning (it works), and one to change the HorizontalScale (has no effect whatsoever):

void AppearanceData::MainLookAndFeel::createTabTextLayout (const TabBarButton& button, float length, float depth,
                                                           Colour colour, TextLayout& textLayout)
{
    Font font (depth * 0.5f);
    font.setUnderline (button.hasKeyboardFocus (false));
    
    font.setExtraKerningFactor(0.05f);  // this works
    font.setHorizontalScale(1.5f);      // THIS DOES NOT!
    
    AttributedString s;
    s.setJustification (Justification::centred);
    s.append (button.getButtonText().trim(), font, colour);
    
    textLayout.createLayout (s, length);
}

I’ve tried changing the width of the tabs to allow a LOT of extra space, in case the text is being compressed, but that does not seem to be the issue.

After further testing, it would appear that an AttributedString is incapable of drawing with a font horizontalScale factor. It simply ignores it (on a Mac at least). Can anyone confirm that?

I can make the TabbedButtons draw their text with a horizontalScale by replacing the AttributedString and textLayout stuff, and just using drawFittedText() from the LookAndFeel_V2 implementation.

1 Like

Thank you!