mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Font: Deprecate old Font constructors
This commit is contained in:
parent
2ed9b84070
commit
4f2c287f9b
95 changed files with 428 additions and 209 deletions
|
|
@ -227,7 +227,7 @@ class CubicBezierSettingsComponent final : public Component
|
|||
public:
|
||||
CubicBezierSettingsComponent()
|
||||
{
|
||||
textEditor.setFont (Font (18.0f));
|
||||
textEditor.setFont (FontOptions (18.0f));
|
||||
textEditor.setColour (TextEditor::ColourIds::backgroundColourId, {});
|
||||
textEditor.setColour (TextEditor::ColourIds::highlightColourId, {});
|
||||
textEditor.setColour (TextEditor::ColourIds::outlineColourId, {});
|
||||
|
|
|
|||
|
|
@ -218,20 +218,20 @@ public:
|
|||
if (rowIsSelected)
|
||||
g.fillAll (Colours::lightblue);
|
||||
|
||||
auto font = fonts[rowNumber];
|
||||
auto font = getFont (rowNumber);
|
||||
|
||||
AttributedString s;
|
||||
s.setWordWrap (AttributedString::none);
|
||||
s.setJustification (Justification::centredLeft);
|
||||
s.append (getNameForRow (rowNumber), font.withHeight ((float) height * 0.7f), Colours::black);
|
||||
s.append (" " + font.getTypefaceName(), Font ((float) height * 0.5f, Font::italic), Colours::grey);
|
||||
s.append (" " + font.getTypefaceName(), FontOptions ((float) height * 0.5f, Font::italic), Colours::grey);
|
||||
|
||||
s.draw (g, Rectangle<int> (width, height).expanded (-4, 50).toFloat());
|
||||
}
|
||||
|
||||
String getNameForRow (int rowNumber) override
|
||||
{
|
||||
return fonts[rowNumber].getTypefaceName();
|
||||
return getFont (rowNumber).getTypefaceName();
|
||||
}
|
||||
|
||||
void selectedRowsChanged (int /*lastRowselected*/) override
|
||||
|
|
@ -240,6 +240,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Font getFont (int rowNumber) const
|
||||
{
|
||||
return isPositiveAndBelow (rowNumber, fonts.size()) ? fonts.getUnchecked (rowNumber) : FontOptions{};
|
||||
}
|
||||
|
||||
Array<Font> fonts;
|
||||
StringArray currentStyleList;
|
||||
|
||||
|
|
@ -317,7 +322,7 @@ private:
|
|||
auto italic = italicToggle.getToggleState();
|
||||
auto useStyle = ! (bold || italic);
|
||||
|
||||
auto font = fonts[listBox.getSelectedRow()];
|
||||
auto font = getFont (listBox.getSelectedRow());
|
||||
|
||||
font = font.withPointHeight ((float) heightSlider .getValue())
|
||||
.withExtraKerningFactor ((float) kerningSlider.getValue())
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public:
|
|||
: Component (name),
|
||||
controls (cc)
|
||||
{
|
||||
displayFont = Font (Font::getDefaultMonospacedFontName(), 12.0f, Font::bold);
|
||||
displayFont = FontOptions (Font::getDefaultMonospacedFontName(), 12.0f, Font::bold);
|
||||
}
|
||||
|
||||
AffineTransform getTransform()
|
||||
|
|
@ -278,7 +278,7 @@ public:
|
|||
|
||||
double lastRenderStartTime = 0.0, averageTimeMs = 0.0, averageActualFPS = 0.0;
|
||||
Image clipImage;
|
||||
Font displayFont;
|
||||
Font displayFont { FontOptions{} };
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphicsDemoBase)
|
||||
};
|
||||
|
|
@ -458,7 +458,7 @@ public:
|
|||
GlyphsDemo (ControllersComponent& cc)
|
||||
: GraphicsDemoBase (cc, "Glyphs")
|
||||
{
|
||||
glyphs.addFittedText ({ 20.0f }, "The Quick Brown Fox Jumps Over The Lazy Dog",
|
||||
glyphs.addFittedText (FontOptions { 20.0f }, "The Quick Brown Fox Jumps Over The Lazy Dog",
|
||||
-120, -50, 240, 100, Justification::centred, 2, 1.0f);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
{
|
||||
addAndMakeVisible (helloWorldLabel);
|
||||
|
||||
helloWorldLabel.setFont (Font (40.00f, Font::bold));
|
||||
helloWorldLabel.setFont (FontOptions (40.00f, Font::bold));
|
||||
helloWorldLabel.setJustificationType (Justification::centred);
|
||||
helloWorldLabel.setEditable (false, false, false);
|
||||
helloWorldLabel.setColour (Label::textColourId, Colours::black);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ private:
|
|||
|
||||
burgerButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20));
|
||||
|
||||
titleLabel.setFont (Font ((float) getHeight() * 0.5f, Font::plain));
|
||||
titleLabel.setFont (FontOptions ((float) getHeight() * 0.5f, Font::plain));
|
||||
titleLabel.setBounds (r);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -997,7 +997,7 @@ private:
|
|||
{
|
||||
addAndMakeVisible (statusLabel);
|
||||
statusLabel.setJustificationType (Justification::topLeft);
|
||||
statusLabel.setFont (Font (14.0f));
|
||||
statusLabel.setFont (FontOptions (14.0f));
|
||||
|
||||
addAndMakeVisible (sizeSlider);
|
||||
sizeSlider.setRange (0.0, 1.0, 0.001);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
addAndMakeVisible (statusLabel);
|
||||
statusLabel.setJustificationType (Justification::topLeft);
|
||||
statusLabel.setFont (Font (14.0f));
|
||||
statusLabel.setFont (FontOptions (14.0f));
|
||||
|
||||
auto presets = getPresets();
|
||||
|
||||
|
|
|
|||
|
|
@ -1156,7 +1156,7 @@ public:
|
|||
|
||||
private:
|
||||
TableListBox table; // the table component itself
|
||||
Font font { 14.0f };
|
||||
Font font { FontOptions { 14.0f } };
|
||||
|
||||
std::unique_ptr<XmlElement> demoData; // This is the XML document loaded from the embedded file "demo table data.xml"
|
||||
XmlElement* columnList = nullptr; // A pointer to the sub-node of demoData that contains the list of columns
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue