PopupMenu fonts mismatch LookAndFeel::getPopupMenuFont


The Font height when launching a PopupMenu, the drawn Font that is used to draw the items doesn’t match the Font that is returned from LookAndFeel::getPopupMenuFont

When a popup item is drawn in LookAndFeel::drawPopupMenuItem, the area in which the item is drawn is reduced in height by 1 pixels from top and bottom.
auto r = area.reduced (1); See line 783 in LookAndFeel_V4.cpp

This reduction is not considered when calculating the item size in LookAndFeel::getIdealPopupMenuItemSize.
Overriding the LookAndFeel and add the 2 pixels to the calculated height fixes it.

Here is some example code that makes clear that the popup shows a different font than is desired. Note that with the ComboBox there is no issue, since with a ComboBox the item heights are set equal to the ComboBox component height.

class MainComponent   : public Component
        setLookAndFeel (&lookAndFeel);
        // Button items fonts are drawn shrinked
        addAndMakeVisible (button);
        button.setButtonText ("PopupMenu manually");
        button.onClick = [&]
            PopupMenu popup;
            popup.setLookAndFeel (&getLookAndFeel());
            popup.addItem ("Item Shrinked1", nullptr);
            popup.addItem ("Item Shrinked2", nullptr);
            popup.addItem ("Item Shrinked3", nullptr);
            popup.showAt (&button);
        // Combo items fonts are drawn correctly
        addAndMakeVisible (combo);
        combo.setTextWhenNothingSelected ("PopupMenu from Combo");
            auto* popup = combo.getRootMenu();
            popup->addItem ("Item Correct1", nullptr);
            popup->addItem ("Item Correct2", nullptr);
            popup->addItem ("Item Correct3", nullptr);
        // Label is drawn correctly
        addAndMakeVisible (label);
        label.setText ("This is the correct font", dontSendNotification);
        label.setFont (Font (20.0f));
        setSize (700, 200);
        setLookAndFeel (nullptr);

    void paint (Graphics& g) override
        g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
    void resized() override
        button.setBounds (10, 10, 200, 60);
        combo.setBounds (220, 10, 200, 60);
        label.setBounds (430, 10, 200, 60);

    struct MyLookAndFeel : LookAndFeel_V4
        Font getPopupMenuFont() override
            return Font (20.0f);
    MyLookAndFeel lookAndFeel;
    TextButton button;
    ComboBox combo;
    Label label;

Hopefully this is something that can be fixed,