1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

LookAndFeel: Allow specifying a default typeface metrics kind to use

This commit is contained in:
reuk 2024-03-20 14:37:06 +00:00
parent fa81badb30
commit 4533077b75
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
26 changed files with 82 additions and 60 deletions

View file

@ -382,7 +382,7 @@ private:
ColourSelector& owner;
Colour currentColour;
Font labelFont { FontOptions { 14.0f, Font::bold } };
Font labelFont { withDefaultMetrics (FontOptions { 14.0f, Font::bold }) };
int labelWidth = 0;
Label colourLabel;

View file

@ -97,7 +97,7 @@ public:
if (keyNum < 0)
setSize (h, h);
else
setSize (jlimit (h * 4, h * 8, 6 + Font (FontOptions { (float) h * 0.6f }).getStringWidth (getName())), h);
setSize (jlimit (h * 4, h * 8, 6 + Font (withDefaultMetrics (FontOptions { (float) h * 0.6f })).getStringWidth (getName())), h);
}
//==============================================================================
@ -321,7 +321,7 @@ public:
void paintItem (Graphics& g, int width, int height) override
{
g.setFont (FontOptions ((float) height * 0.7f, Font::bold));
g.setFont (owner.withDefaultMetrics (FontOptions ((float) height * 0.7f, Font::bold)));
g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId));
g.drawText (TRANS (categoryName), 2, 0, width - 2, height, Justification::centredLeft, true);

View file

@ -144,7 +144,7 @@ LivePropertyEditorBase::LivePropertyEditorBase (LiveValueBase& v, CodeDocument&
findOriginalValueInCode();
selectOriginalValue();
name.setFont (FontOptions { 13.0f });
name.setFont (withDefaultMetrics (FontOptions { 13.0f }));
name.setText (v.name, dontSendNotification);
valueEditor.setMultiLine (v.isString());
valueEditor.setReturnKeyStartsNewLine (v.isString());