1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +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

@ -82,7 +82,7 @@ static void drawTextLayout (Graphics& g, Component& owner, StringRef text, const
AttributedString attributedString { text };
attributedString.setColour (textColour);
attributedString.setFont (FontOptions { (float) textBounds.getHeight() * 0.6f });
attributedString.setFont (owner.withDefaultMetrics (FontOptions { (float) textBounds.getHeight() * 0.6f }));
attributedString.setJustification (Justification::centredLeft);
attributedString.setWordWrap (AttributedString::WordWrap::none);

View file

@ -109,7 +109,7 @@ void MPEKeyboardComponent::drawWhiteKey (int midiNoteNumber, Graphics& g, Rectan
auto text = MidiMessage::getMidiNoteName (midiNoteNumber, true, true, getOctaveForMiddleC());
g.setColour (findColour (textLabelColourId));
g.setFont (Font (FontOptions { fontHeight }).withHorizontalScale (0.8f));
g.setFont (withDefaultMetrics (FontOptions { fontHeight }).withHorizontalScale (0.8f));
switch (getOrientation())
{

View file

@ -379,7 +379,7 @@ void MidiKeyboardComponent::drawWhiteNote (int midiNoteNumber, Graphics& g, Rect
auto fontHeight = jmin (12.0f, getKeyWidth() * 0.9f);
g.setColour (textColour);
g.setFont (Font (FontOptions { fontHeight }).withHorizontalScale (0.8f));
g.setFont (withDefaultMetrics (FontOptions { fontHeight }).withHorizontalScale (0.8f));
switch (currentOrientation)
{