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
|
|
@ -2,6 +2,35 @@
|
||||||
|
|
||||||
# Version 8.0.0
|
# Version 8.0.0
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
Signatures of several Typeface member functions have been updated to accept a
|
||||||
|
new TypefaceMetricsKind argument. The getAscent(), getDescent(), and
|
||||||
|
getHeightToPointsFactor() members have been replaced by getMetrics(), which
|
||||||
|
returns the same metrics information all at once.
|
||||||
|
|
||||||
|
**Possible Issues**
|
||||||
|
|
||||||
|
Code that calls any of the affected functions will fail to compile.
|
||||||
|
|
||||||
|
**Workaround**
|
||||||
|
|
||||||
|
Specify the kind of metrics you require when calling Typeface member functions.
|
||||||
|
Call getMetrics() instead of the old individual getters for metrics.
|
||||||
|
|
||||||
|
**Rationale**
|
||||||
|
|
||||||
|
Until now, the same font data could produce different results from
|
||||||
|
Typeface::getAscent() et al. depending on the platform. The updated interfaces
|
||||||
|
allow the user to choose between the old-style non-portable metrics (to avoid
|
||||||
|
layout changes in existing projects), and portable metrics (more suitable for
|
||||||
|
new or cross-platform projects).
|
||||||
|
Most users will fetch metrics from Font objects rather than from the Typeface.
|
||||||
|
Font will continue to return non-portable metrics when constructed using the
|
||||||
|
existing (deprecated) constructors. Portable metrics can be enabled by
|
||||||
|
switching to the new Font constructor that takes a FontOptions argument.
|
||||||
|
|
||||||
|
|
||||||
## Change
|
## Change
|
||||||
|
|
||||||
Typeface::getOutlineForGlyph now returns void instead of bool.
|
Typeface::getOutlineForGlyph now returns void instead of bool.
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ public:
|
||||||
AudioPlaybackDemo()
|
AudioPlaybackDemo()
|
||||||
{
|
{
|
||||||
addAndMakeVisible (zoomLabel);
|
addAndMakeVisible (zoomLabel);
|
||||||
zoomLabel.setFont (Font (15.00f, Font::plain));
|
zoomLabel.setFont (FontOptions (15.00f, Font::plain));
|
||||||
zoomLabel.setJustificationType (Justification::centredRight);
|
zoomLabel.setJustificationType (Justification::centredRight);
|
||||||
zoomLabel.setEditable (false, false, false);
|
zoomLabel.setEditable (false, false, false);
|
||||||
zoomLabel.setColour (TextEditor::textColourId, Colours::black);
|
zoomLabel.setColour (TextEditor::textColourId, Colours::black);
|
||||||
|
|
@ -289,7 +289,7 @@ public:
|
||||||
fileTreeComp.addListener (this);
|
fileTreeComp.addListener (this);
|
||||||
|
|
||||||
addAndMakeVisible (explanation);
|
addAndMakeVisible (explanation);
|
||||||
explanation.setFont (Font (14.00f, Font::plain));
|
explanation.setFont (FontOptions (14.00f, Font::plain));
|
||||||
explanation.setJustificationType (Justification::bottomRight);
|
explanation.setJustificationType (Justification::bottomRight);
|
||||||
explanation.setEditable (false, false, false);
|
explanation.setEditable (false, false, false);
|
||||||
explanation.setColour (TextEditor::textColourId, Colours::black);
|
explanation.setColour (TextEditor::textColourId, Colours::black);
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ public:
|
||||||
addAndMakeVisible (liveAudioScroller);
|
addAndMakeVisible (liveAudioScroller);
|
||||||
|
|
||||||
addAndMakeVisible (explanationLabel);
|
addAndMakeVisible (explanationLabel);
|
||||||
explanationLabel.setFont (Font (15.0f, Font::plain));
|
explanationLabel.setFont (FontOptions (15.0f, Font::plain));
|
||||||
explanationLabel.setJustificationType (Justification::topLeft);
|
explanationLabel.setJustificationType (Justification::topLeft);
|
||||||
explanationLabel.setEditable (false, false, false);
|
explanationLabel.setEditable (false, false, false);
|
||||||
explanationLabel.setColour (TextEditor::textColourId, Colours::black);
|
explanationLabel.setColour (TextEditor::textColourId, Colours::black);
|
||||||
|
|
|
||||||
|
|
@ -907,7 +907,7 @@ class MonospaceEditor : public TextEditor
|
||||||
public:
|
public:
|
||||||
MonospaceEditor()
|
MonospaceEditor()
|
||||||
{
|
{
|
||||||
setFont (Font { Font::getDefaultMonospacedFontName(), 12, 0 });
|
setFont (FontOptions { Font::getDefaultMonospacedFontName(), 12, 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
void onCommit (std::function<void()> fn)
|
void onCommit (std::function<void()> fn)
|
||||||
|
|
@ -926,7 +926,7 @@ class MonospaceLabel : public Label
|
||||||
public:
|
public:
|
||||||
MonospaceLabel()
|
MonospaceLabel()
|
||||||
{
|
{
|
||||||
setFont (Font { Font::getDefaultMonospacedFontName(), 12, 0 });
|
setFont (FontOptions { Font::getDefaultMonospacedFontName(), 12, 0 });
|
||||||
setMinimumHorizontalScale (1.0f);
|
setMinimumHorizontalScale (1.0f);
|
||||||
setInterceptsMouseClicks (false, false);
|
setInterceptsMouseClicks (false, false);
|
||||||
}
|
}
|
||||||
|
|
@ -1531,7 +1531,7 @@ public:
|
||||||
|
|
||||||
const auto groupWidth = 100;
|
const auto groupWidth = 100;
|
||||||
GlyphArrangement groupArrangement;
|
GlyphArrangement groupArrangement;
|
||||||
groupArrangement.addJustifiedText ({},
|
groupArrangement.addJustifiedText (FontOptions{},
|
||||||
"Group",
|
"Group",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
@ -1571,7 +1571,7 @@ public:
|
||||||
const auto bounds = buttons[(size_t) i].getBounds();
|
const auto bounds = buttons[(size_t) i].getBounds();
|
||||||
|
|
||||||
GlyphArrangement channelArrangement;
|
GlyphArrangement channelArrangement;
|
||||||
channelArrangement.addJustifiedText ({},
|
channelArrangement.addJustifiedText (FontOptions{},
|
||||||
i < 16 ? String (i + 1) : "All",
|
i < 16 ? String (i + 1) : "All",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void addLabelAndSetStyle (Label& label)
|
void addLabelAndSetStyle (Label& label)
|
||||||
{
|
{
|
||||||
label.setFont (Font (15.00f, Font::plain));
|
label.setFont (FontOptions (15.00f, Font::plain));
|
||||||
label.setJustificationType (Justification::centredLeft);
|
label.setJustificationType (Justification::centredLeft);
|
||||||
label.setEditable (false, false, false);
|
label.setEditable (false, false, false);
|
||||||
label.setColour (TextEditor::textColourId, Colours::black);
|
label.setColour (TextEditor::textColourId, Colours::black);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ void MainComponent::paint (juce::Graphics& g)
|
||||||
// (Our component is opaque, so we must completely fill the background with a solid colour)
|
// (Our component is opaque, so we must completely fill the background with a solid colour)
|
||||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
||||||
|
|
||||||
g.setFont (juce::Font (16.0f));
|
g.setFont (juce::FontOptions (16.0f));
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.drawText ("Hello World!", getLocalBounds(), juce::Justification::centred, true);
|
g.drawText ("Hello World!", getLocalBounds(), juce::Justification::centred, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ private:
|
||||||
mainComponent (comp)
|
mainComponent (comp)
|
||||||
{
|
{
|
||||||
addAndMakeVisible (titleLabel);
|
addAndMakeVisible (titleLabel);
|
||||||
titleLabel.setFont (titleLabelFontHeight);
|
titleLabel.setFont (FontOptions { titleLabelFontHeight });
|
||||||
|
|
||||||
addLookAndFeels();
|
addLookAndFeels();
|
||||||
|
|
||||||
|
|
@ -184,7 +184,7 @@ private:
|
||||||
: deviceSelectorComp (getSharedAudioDeviceManager(), 0, 256, 0, 256, true, true, true, false)
|
: deviceSelectorComp (getSharedAudioDeviceManager(), 0, 256, 0, 256, true, true, true, false)
|
||||||
{
|
{
|
||||||
addAndMakeVisible (titleLabel);
|
addAndMakeVisible (titleLabel);
|
||||||
titleLabel.setFont (titleLabelFontHeight);
|
titleLabel.setFont (FontOptions { titleLabelFontHeight });
|
||||||
|
|
||||||
addAndMakeVisible (deviceSelectorComp);
|
addAndMakeVisible (deviceSelectorComp);
|
||||||
deviceSelectorComp.setItemHeight (itemHeight);
|
deviceSelectorComp.setItemHeight (itemHeight);
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ class CubicBezierSettingsComponent final : public Component
|
||||||
public:
|
public:
|
||||||
CubicBezierSettingsComponent()
|
CubicBezierSettingsComponent()
|
||||||
{
|
{
|
||||||
textEditor.setFont (Font (18.0f));
|
textEditor.setFont (FontOptions (18.0f));
|
||||||
textEditor.setColour (TextEditor::ColourIds::backgroundColourId, {});
|
textEditor.setColour (TextEditor::ColourIds::backgroundColourId, {});
|
||||||
textEditor.setColour (TextEditor::ColourIds::highlightColourId, {});
|
textEditor.setColour (TextEditor::ColourIds::highlightColourId, {});
|
||||||
textEditor.setColour (TextEditor::ColourIds::outlineColourId, {});
|
textEditor.setColour (TextEditor::ColourIds::outlineColourId, {});
|
||||||
|
|
|
||||||
|
|
@ -218,20 +218,20 @@ public:
|
||||||
if (rowIsSelected)
|
if (rowIsSelected)
|
||||||
g.fillAll (Colours::lightblue);
|
g.fillAll (Colours::lightblue);
|
||||||
|
|
||||||
auto font = fonts[rowNumber];
|
auto font = getFont (rowNumber);
|
||||||
|
|
||||||
AttributedString s;
|
AttributedString s;
|
||||||
s.setWordWrap (AttributedString::none);
|
s.setWordWrap (AttributedString::none);
|
||||||
s.setJustification (Justification::centredLeft);
|
s.setJustification (Justification::centredLeft);
|
||||||
s.append (getNameForRow (rowNumber), font.withHeight ((float) height * 0.7f), Colours::black);
|
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());
|
s.draw (g, Rectangle<int> (width, height).expanded (-4, 50).toFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
String getNameForRow (int rowNumber) override
|
String getNameForRow (int rowNumber) override
|
||||||
{
|
{
|
||||||
return fonts[rowNumber].getTypefaceName();
|
return getFont (rowNumber).getTypefaceName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectedRowsChanged (int /*lastRowselected*/) override
|
void selectedRowsChanged (int /*lastRowselected*/) override
|
||||||
|
|
@ -240,6 +240,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Font getFont (int rowNumber) const
|
||||||
|
{
|
||||||
|
return isPositiveAndBelow (rowNumber, fonts.size()) ? fonts.getUnchecked (rowNumber) : FontOptions{};
|
||||||
|
}
|
||||||
|
|
||||||
Array<Font> fonts;
|
Array<Font> fonts;
|
||||||
StringArray currentStyleList;
|
StringArray currentStyleList;
|
||||||
|
|
||||||
|
|
@ -317,7 +322,7 @@ private:
|
||||||
auto italic = italicToggle.getToggleState();
|
auto italic = italicToggle.getToggleState();
|
||||||
auto useStyle = ! (bold || italic);
|
auto useStyle = ! (bold || italic);
|
||||||
|
|
||||||
auto font = fonts[listBox.getSelectedRow()];
|
auto font = getFont (listBox.getSelectedRow());
|
||||||
|
|
||||||
font = font.withPointHeight ((float) heightSlider .getValue())
|
font = font.withPointHeight ((float) heightSlider .getValue())
|
||||||
.withExtraKerningFactor ((float) kerningSlider.getValue())
|
.withExtraKerningFactor ((float) kerningSlider.getValue())
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ public:
|
||||||
: Component (name),
|
: Component (name),
|
||||||
controls (cc)
|
controls (cc)
|
||||||
{
|
{
|
||||||
displayFont = Font (Font::getDefaultMonospacedFontName(), 12.0f, Font::bold);
|
displayFont = FontOptions (Font::getDefaultMonospacedFontName(), 12.0f, Font::bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
AffineTransform getTransform()
|
AffineTransform getTransform()
|
||||||
|
|
@ -278,7 +278,7 @@ public:
|
||||||
|
|
||||||
double lastRenderStartTime = 0.0, averageTimeMs = 0.0, averageActualFPS = 0.0;
|
double lastRenderStartTime = 0.0, averageTimeMs = 0.0, averageActualFPS = 0.0;
|
||||||
Image clipImage;
|
Image clipImage;
|
||||||
Font displayFont;
|
Font displayFont { FontOptions{} };
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphicsDemoBase)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphicsDemoBase)
|
||||||
};
|
};
|
||||||
|
|
@ -458,7 +458,7 @@ public:
|
||||||
GlyphsDemo (ControllersComponent& cc)
|
GlyphsDemo (ControllersComponent& cc)
|
||||||
: GraphicsDemoBase (cc, "Glyphs")
|
: 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);
|
-120, -50, 240, 100, Justification::centred, 2, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public:
|
||||||
{
|
{
|
||||||
addAndMakeVisible (helloWorldLabel);
|
addAndMakeVisible (helloWorldLabel);
|
||||||
|
|
||||||
helloWorldLabel.setFont (Font (40.00f, Font::bold));
|
helloWorldLabel.setFont (FontOptions (40.00f, Font::bold));
|
||||||
helloWorldLabel.setJustificationType (Justification::centred);
|
helloWorldLabel.setJustificationType (Justification::centred);
|
||||||
helloWorldLabel.setEditable (false, false, false);
|
helloWorldLabel.setEditable (false, false, false);
|
||||||
helloWorldLabel.setColour (Label::textColourId, Colours::black);
|
helloWorldLabel.setColour (Label::textColourId, Colours::black);
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ private:
|
||||||
|
|
||||||
burgerButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20));
|
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);
|
titleLabel.setBounds (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -997,7 +997,7 @@ private:
|
||||||
{
|
{
|
||||||
addAndMakeVisible (statusLabel);
|
addAndMakeVisible (statusLabel);
|
||||||
statusLabel.setJustificationType (Justification::topLeft);
|
statusLabel.setJustificationType (Justification::topLeft);
|
||||||
statusLabel.setFont (Font (14.0f));
|
statusLabel.setFont (FontOptions (14.0f));
|
||||||
|
|
||||||
addAndMakeVisible (sizeSlider);
|
addAndMakeVisible (sizeSlider);
|
||||||
sizeSlider.setRange (0.0, 1.0, 0.001);
|
sizeSlider.setRange (0.0, 1.0, 0.001);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
addAndMakeVisible (statusLabel);
|
addAndMakeVisible (statusLabel);
|
||||||
statusLabel.setJustificationType (Justification::topLeft);
|
statusLabel.setJustificationType (Justification::topLeft);
|
||||||
statusLabel.setFont (Font (14.0f));
|
statusLabel.setFont (FontOptions (14.0f));
|
||||||
|
|
||||||
auto presets = getPresets();
|
auto presets = getPresets();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1156,7 +1156,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TableListBox table; // the table component itself
|
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"
|
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
|
XmlElement* columnList = nullptr; // A pointer to the sub-node of demoData that contains the list of columns
|
||||||
|
|
|
||||||
|
|
@ -1049,7 +1049,7 @@ public:
|
||||||
|
|
||||||
const auto rulerHeight = bounds.getHeight() / 3;
|
const auto rulerHeight = bounds.getHeight() / 3;
|
||||||
g.drawRect (drawBounds.getX(), rulerHeight, drawBounds.getRight(), rulerHeight);
|
g.drawRect (drawBounds.getX(), rulerHeight, drawBounds.getRight(), rulerHeight);
|
||||||
g.setFont (Font (12.0f));
|
g.setFont (FontOptions (12.0f));
|
||||||
|
|
||||||
const int lightLineWidth = 1;
|
const int lightLineWidth = 1;
|
||||||
const int heavyLineWidth = 3;
|
const int heavyLineWidth = 3;
|
||||||
|
|
@ -1455,12 +1455,12 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g.setFont (Font (12.0f));
|
g.setFont (FontOptions (12.0f));
|
||||||
g.drawText ("Audio Access Disabled", getLocalBounds(), Justification::centred);
|
g.drawText ("Audio Access Disabled", getLocalBounds(), Justification::centred);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setColour (Colours::white.withMultipliedAlpha (0.9f));
|
g.setColour (Colours::white.withMultipliedAlpha (0.9f));
|
||||||
g.setFont (Font (12.0f));
|
g.setFont (FontOptions (12.0f));
|
||||||
g.drawText (convertOptionalARAString (playbackRegion.getEffectiveName()),
|
g.drawText (convertOptionalARAString (playbackRegion.getEffectiveName()),
|
||||||
getLocalBounds(),
|
getLocalBounds(),
|
||||||
Justification::topLeft);
|
Justification::topLeft);
|
||||||
|
|
@ -2325,7 +2325,7 @@ public:
|
||||||
if (! isARAEditorView())
|
if (! isARAEditorView())
|
||||||
{
|
{
|
||||||
g.setColour (Colours::white);
|
g.setColour (Colours::white);
|
||||||
g.setFont (15.0f);
|
g.setFont (FontOptions (15.0f));
|
||||||
g.drawFittedText ("ARA host isn't detected. This plugin only supports ARA mode",
|
g.drawFittedText ("ARA host isn't detected. This plugin only supports ARA mode",
|
||||||
getLocalBounds(),
|
getLocalBounds(),
|
||||||
Justification::centred,
|
Justification::centred,
|
||||||
|
|
|
||||||
|
|
@ -386,17 +386,17 @@ private:
|
||||||
|
|
||||||
// add some labels for the sliders..
|
// add some labels for the sliders..
|
||||||
gainLabel.attachToComponent (&gainSlider, false);
|
gainLabel.attachToComponent (&gainSlider, false);
|
||||||
gainLabel.setFont (Font (11.0f));
|
gainLabel.setFont (FontOptions (11.0f));
|
||||||
|
|
||||||
delayLabel.attachToComponent (&delaySlider, false);
|
delayLabel.attachToComponent (&delaySlider, false);
|
||||||
delayLabel.setFont (Font (11.0f));
|
delayLabel.setFont (FontOptions (11.0f));
|
||||||
|
|
||||||
// add the midi keyboard component..
|
// add the midi keyboard component..
|
||||||
addAndMakeVisible (midiKeyboard);
|
addAndMakeVisible (midiKeyboard);
|
||||||
|
|
||||||
// add a label that will display the current timecode and status..
|
// add a label that will display the current timecode and status..
|
||||||
addAndMakeVisible (timecodeDisplayLabel);
|
addAndMakeVisible (timecodeDisplayLabel);
|
||||||
timecodeDisplayLabel.setFont (Font (Font::getDefaultMonospacedFontName(), 15.0f, Font::plain));
|
timecodeDisplayLabel.setFont (FontOptions (Font::getDefaultMonospacedFontName(), 15.0f, Font::plain));
|
||||||
|
|
||||||
// set resize limits for this plug-in
|
// set resize limits for this plug-in
|
||||||
setResizeLimits (400, 200, 1024, 700);
|
setResizeLimits (400, 200, 1024, 700);
|
||||||
|
|
|
||||||
|
|
@ -1582,10 +1582,10 @@ public:
|
||||||
g.fillRect (rectChoice);
|
g.fillRect (rectChoice);
|
||||||
|
|
||||||
g.setColour (Colours::white);
|
g.setColour (Colours::white);
|
||||||
g.setFont (Font (20.0f).italicised().withExtraKerningFactor (0.1f));
|
g.setFont (Font (FontOptions (20.0f)).italicised().withExtraKerningFactor (0.1f));
|
||||||
g.drawFittedText ("DSP MODULE DEMO", rectTop.reduced (10, 0), Justification::centredLeft, 1);
|
g.drawFittedText ("DSP MODULE DEMO", rectTop.reduced (10, 0), Justification::centredLeft, 1);
|
||||||
|
|
||||||
g.setFont (Font (14.0f));
|
g.setFont (FontOptions (14.0f));
|
||||||
String strText = "IR length (reverb): " + String (proc.getCurrentIRSize()) + " samples";
|
String strText = "IR length (reverb): " + String (proc.getCurrentIRSize()) + " samples";
|
||||||
g.drawFittedText (strText, rectBottom.reduced (10, 0), Justification::centredRight, 1);
|
g.drawFittedText (strText, rectBottom.reduced (10, 0), Justification::centredRight, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public:
|
||||||
|
|
||||||
addAndMakeVisible (testResultsBox);
|
addAndMakeVisible (testResultsBox);
|
||||||
testResultsBox.setMultiLine (true);
|
testResultsBox.setMultiLine (true);
|
||||||
testResultsBox.setFont ({ Font::getDefaultMonospacedFontName(), 12.0f, Font::plain });
|
testResultsBox.setFont (FontOptions { Font::getDefaultMonospacedFontName(), 12.0f, Font::plain });
|
||||||
|
|
||||||
logMessage (String ("This demo uses the ChildProcessCoordinator and ChildProcessWorker classes to launch and communicate "
|
logMessage (String ("This demo uses the ChildProcessCoordinator and ChildProcessWorker classes to launch and communicate "
|
||||||
"with a child process, sending messages in the form of serialised ValueTree objects.") + newLine
|
"with a child process, sending messages in the form of serialised ValueTree objects.") + newLine
|
||||||
|
|
|
||||||
|
|
@ -395,10 +395,10 @@ public:
|
||||||
else
|
else
|
||||||
stopTimer();
|
stopTimer();
|
||||||
|
|
||||||
nameLabel.setFont (Font (16).withStyle (Font::bold | (hasBeenPurchased ? 0 : Font::italic)));
|
nameLabel.setFont (FontOptions { 16.0f, Font::bold | (hasBeenPurchased ? 0 : Font::italic) });
|
||||||
nameLabel.setColour (Label::textColourId, hasBeenPurchased ? Colours::white : Colours::grey);
|
nameLabel.setColour (Label::textColourId, hasBeenPurchased ? Colours::white : Colours::grey);
|
||||||
|
|
||||||
priceLabel.setFont (Font (10).withStyle (purchase.priceIsKnown ? 0 : Font::italic));
|
priceLabel.setFont (FontOptions { 10.0f, purchase.priceIsKnown ? 0 : Font::italic });
|
||||||
priceLabel.setColour (Label::textColourId, hasBeenPurchased ? Colours::white : Colours::grey);
|
priceLabel.setColour (Label::textColourId, hasBeenPurchased ? Colours::white : Colours::grey);
|
||||||
priceLabel.setText (purchase.purchasePrice, NotificationType::dontSendNotification);
|
priceLabel.setText (purchase.purchasePrice, NotificationType::dontSendNotification);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,13 +86,13 @@ public:
|
||||||
|
|
||||||
editor.reset (new CodeEditorComponent (codeDocument, nullptr));
|
editor.reset (new CodeEditorComponent (codeDocument, nullptr));
|
||||||
addAndMakeVisible (editor.get());
|
addAndMakeVisible (editor.get());
|
||||||
editor->setFont ({ Font::getDefaultMonospacedFontName(), 14.0f, Font::plain });
|
editor->setFont (FontOptions { Font::getDefaultMonospacedFontName(), 14.0f, Font::plain });
|
||||||
editor->setTabSize (4, true);
|
editor->setTabSize (4, true);
|
||||||
|
|
||||||
outputDisplay.setMultiLine (true);
|
outputDisplay.setMultiLine (true);
|
||||||
outputDisplay.setReadOnly (true);
|
outputDisplay.setReadOnly (true);
|
||||||
outputDisplay.setCaretVisible (false);
|
outputDisplay.setCaretVisible (false);
|
||||||
outputDisplay.setFont ({ Font::getDefaultMonospacedFontName(), 14.0f, Font::plain });
|
outputDisplay.setFont (FontOptions { Font::getDefaultMonospacedFontName(), 14.0f, Font::plain });
|
||||||
addAndMakeVisible (outputDisplay);
|
addAndMakeVisible (outputDisplay);
|
||||||
|
|
||||||
codeDocument.addListener (this);
|
codeDocument.addListener (this);
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ private:
|
||||||
auto textColour = isConnected() ? Colours::green : Colours::red;
|
auto textColour = isConnected() ? Colours::green : Colours::red;
|
||||||
|
|
||||||
connectionStatusLabel.setText (text, dontSendNotification);
|
connectionStatusLabel.setText (text, dontSendNotification);
|
||||||
connectionStatusLabel.setFont (Font (15.00f, Font::bold));
|
connectionStatusLabel.setFont (FontOptions (15.00f, Font::bold));
|
||||||
connectionStatusLabel.setColour (Label::textColourId, textColour);
|
connectionStatusLabel.setColour (Label::textColourId, textColour);
|
||||||
connectionStatusLabel.setJustificationType (Justification::centredRight);
|
connectionStatusLabel.setJustificationType (Justification::centredRight);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ public:
|
||||||
resultsBox.setReadOnly (true);
|
resultsBox.setReadOnly (true);
|
||||||
resultsBox.setMultiLine (true);
|
resultsBox.setMultiLine (true);
|
||||||
resultsBox.setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
|
resultsBox.setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
|
||||||
resultsBox.setFont ({ Font::getDefaultMonospacedFontName(), 12.0f, Font::plain });
|
resultsBox.setFont (FontOptions { Font::getDefaultMonospacedFontName(), 12.0f, Font::plain });
|
||||||
resultsBox.setText (getAllSystemInfo());
|
resultsBox.setText (getAllSystemInfo());
|
||||||
|
|
||||||
setSize (500, 500);
|
setSize (500, 500);
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ public:
|
||||||
s.append (newLine);
|
s.append (newLine);
|
||||||
s.append ("Click the \"Set Random Colour\" button to change the colour of one of the circles.");
|
s.append ("Click the \"Set Random Colour\" button to change the colour of one of the circles.");
|
||||||
s.append (newLine);
|
s.append (newLine);
|
||||||
s.setFont (16.0f);
|
s.setFont (FontOptions { 16.0f });
|
||||||
s.setColour (getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::defaultText, Colours::lightgrey));
|
s.setColour (getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::defaultText, Colours::lightgrey));
|
||||||
s.draw (g, explanationArea.reduced (10).toFloat());
|
s.draw (g, explanationArea.reduced (10).toFloat());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public:
|
||||||
|
|
||||||
addAndMakeVisible (testResultsBox);
|
addAndMakeVisible (testResultsBox);
|
||||||
testResultsBox.setMultiLine (true);
|
testResultsBox.setMultiLine (true);
|
||||||
testResultsBox.setFont (Font (Font::getDefaultMonospacedFontName(), 12.0f, Font::plain));
|
testResultsBox.setFont (FontOptions (Font::getDefaultMonospacedFontName(), 12.0f, Font::plain));
|
||||||
|
|
||||||
addAndMakeVisible (categoriesBox);
|
addAndMakeVisible (categoriesBox);
|
||||||
categoriesBox.addItem ("All Tests", 1);
|
categoriesBox.addItem ("All Tests", 1);
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ public:
|
||||||
void paint (Graphics& g) override
|
void paint (Graphics& g) override
|
||||||
{
|
{
|
||||||
g.fillAll (Colours::black);
|
g.fillAll (Colours::black);
|
||||||
g.setFont (Font (16.0f));
|
g.setFont (FontOptions (16.0f));
|
||||||
g.setColour (Colours::white);
|
g.setColour (Colours::white);
|
||||||
g.drawText ("loop iterations / audio callback",
|
g.drawText ("loop iterations / audio callback",
|
||||||
getLocalBounds().withY (loopIterationsSlider.getHeight()), Justification::centred, true);
|
getLocalBounds().withY (loopIterationsSlider.getHeight()), Justification::centred, true);
|
||||||
|
|
|
||||||
|
|
@ -553,7 +553,7 @@ struct GraphEditorPanel::PluginComponent final : public Component,
|
||||||
int numInputs = 0, numOutputs = 0;
|
int numInputs = 0, numOutputs = 0;
|
||||||
int pinSize = 16;
|
int pinSize = 16;
|
||||||
Point<int> originalPos;
|
Point<int> originalPos;
|
||||||
Font font { 13.0f, Font::bold };
|
Font font = FontOptions { 13.0f, Font::bold };
|
||||||
int numIns = 0, numOuts = 0;
|
int numIns = 0, numOuts = 0;
|
||||||
DropShadowEffect shadow;
|
DropShadowEffect shadow;
|
||||||
std::unique_ptr<PopupMenu> menu;
|
std::unique_ptr<PopupMenu> menu;
|
||||||
|
|
@ -1020,7 +1020,7 @@ struct GraphDocumentComponent::TooltipBar final : public Component,
|
||||||
|
|
||||||
void paint (Graphics& g) override
|
void paint (Graphics& g) override
|
||||||
{
|
{
|
||||||
g.setFont (Font ((float) getHeight() * 0.7f, Font::bold));
|
g.setFont (FontOptions ((float) getHeight() * 0.7f, Font::bold));
|
||||||
g.setColour (Colours::black);
|
g.setColour (Colours::black);
|
||||||
g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1);
|
g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -1124,7 +1124,7 @@ private:
|
||||||
|
|
||||||
pluginButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20));
|
pluginButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20));
|
||||||
|
|
||||||
titleLabel.setFont (Font (static_cast<float> (getHeight()) * 0.5f, Font::plain));
|
titleLabel.setFont (FontOptions (static_cast<float> (getHeight()) * 0.5f, Font::plain));
|
||||||
titleLabel.setBounds (r);
|
titleLabel.setBounds (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,14 +164,14 @@ private:
|
||||||
if (clientArea.isEmpty())
|
if (clientArea.isEmpty())
|
||||||
{
|
{
|
||||||
g.setColour (Colours::red.withAlpha (0.5f));
|
g.setColour (Colours::red.withAlpha (0.5f));
|
||||||
g.setFont (20.0f);
|
g.setFont (FontOptions (20.0f));
|
||||||
g.drawText ("Not Connected", getLocalBounds(), Justification::centred, false);
|
g.drawText ("Not Connected", getLocalBounds(), Justification::centred, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.draw (g, getLocalBounds().toFloat(), clientArea);
|
canvas.draw (g, getLocalBounds().toFloat(), clientArea);
|
||||||
|
|
||||||
g.setFont (Font (34.0f));
|
g.setFont (FontOptions (34.0f));
|
||||||
g.setColour (Colours::white.withAlpha (0.6f));
|
g.setColour (Colours::white.withAlpha (0.6f));
|
||||||
|
|
||||||
g.drawText (getMachineInfoToDisplay(),
|
g.drawText (getMachineInfoToDisplay(),
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,7 @@ struct FlockWithText final : public FlockDemo
|
||||||
String text = String (messages[currentMessage]).replace ("NUMDEVICES", String (canvas.clients.size()));
|
String text = String (messages[currentMessage]).replace ("NUMDEVICES", String (canvas.clients.size()));
|
||||||
|
|
||||||
AttributedString as;
|
AttributedString as;
|
||||||
as.append (text, Font (textSize * scale), Colour (0x80ffffff).withMultipliedAlpha (alpha));
|
as.append (text, FontOptions (textSize * scale), Colour (0x80ffffff).withMultipliedAlpha (alpha));
|
||||||
|
|
||||||
as.setJustification (Justification::centred);
|
as.setJustification (Justification::centred);
|
||||||
auto middle = canvas.clients[clientIndex % canvas.clients.size()].centre * scale;
|
auto middle = canvas.clients[clientIndex % canvas.clients.size()].centre * scale;
|
||||||
|
|
|
||||||
|
|
@ -404,12 +404,28 @@ public:
|
||||||
const Font& getFont() override { return getState().font; }
|
const Font& getFont() override { return getState().font; }
|
||||||
void setFont (const Font& newFont) override { getState().font = newFont; }
|
void setFont (const Font& newFont) override { getState().font = newFont; }
|
||||||
|
|
||||||
void drawGlyph (int glyphNumber, const AffineTransform& transform) override
|
void drawGlyphs (Span<const uint16_t> indices,
|
||||||
|
Span<const Point<float>> positions,
|
||||||
|
const AffineTransform& transform) override
|
||||||
{
|
{
|
||||||
Path p;
|
std::unordered_map<uint16_t, Path> cache;
|
||||||
Font& font = getState().font;
|
|
||||||
font.getTypefacePtr()->getOutlineForGlyph (glyphNumber, p);
|
const auto& font = getState().font;
|
||||||
fillPath (p, AffineTransform::scale (font.getHeight() * font.getHorizontalScale(), font.getHeight()).followedBy (transform));
|
|
||||||
|
for (size_t i = 0; i < indices.size(); i++)
|
||||||
|
{
|
||||||
|
const auto glyphNumber = indices[i];
|
||||||
|
const auto pos = positions[i];
|
||||||
|
auto& path = cache[glyphNumber];
|
||||||
|
|
||||||
|
if (path.isEmpty())
|
||||||
|
font.getTypefacePtr()->getOutlineForGlyph (TypefaceMetricsKind::legacy, glyphNumber, path);
|
||||||
|
|
||||||
|
auto t = AffineTransform::scale (font.getHeight() * font.getHorizontalScale(), font.getHeight())
|
||||||
|
.followedBy (AffineTransform::translation (pos))
|
||||||
|
.followedBy (transform);
|
||||||
|
fillPath (path, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -423,7 +439,7 @@ private:
|
||||||
{
|
{
|
||||||
FillType fillType;
|
FillType fillType;
|
||||||
AffineTransform transform;
|
AffineTransform transform;
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
ReferenceCountedObjectPtr<SharedCanvasHolder> transparencyLayer;
|
ReferenceCountedObjectPtr<SharedCanvasHolder> transparencyLayer;
|
||||||
float transparencyOpacity = 1.0f;
|
float transparencyOpacity = 1.0f;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public:
|
||||||
icon (makeIcon (iconSvgData))
|
icon (makeIcon (iconSvgData))
|
||||||
{
|
{
|
||||||
addAndMakeVisible (nameLabel);
|
addAndMakeVisible (nameLabel);
|
||||||
nameLabel.setFont (18.0f);
|
nameLabel.setFont (FontOptions { 18.0f });
|
||||||
nameLabel.setMinimumHorizontalScale (1.0f);
|
nameLabel.setMinimumHorizontalScale (1.0f);
|
||||||
|
|
||||||
addAndMakeVisible (descriptionLabel);
|
addAndMakeVisible (descriptionLabel);
|
||||||
|
|
|
||||||
|
|
@ -73,13 +73,13 @@ public:
|
||||||
addAndMakeVisible (userAvatar);
|
addAndMakeVisible (userAvatar);
|
||||||
|
|
||||||
addAndMakeVisible (createAccountLabel);
|
addAndMakeVisible (createAccountLabel);
|
||||||
createAccountLabel.setFont (Font (14.0f, Font::underlined));
|
createAccountLabel.setFont (FontOptions (14.0f, Font::underlined));
|
||||||
createAccountLabel.addMouseListener (this, false);
|
createAccountLabel.addMouseListener (this, false);
|
||||||
createAccountLabel.setMouseCursor (MouseCursor::PointingHandCursor);
|
createAccountLabel.setMouseCursor (MouseCursor::PointingHandCursor);
|
||||||
|
|
||||||
addAndMakeVisible (errorMessageLabel);
|
addAndMakeVisible (errorMessageLabel);
|
||||||
errorMessageLabel.setMinimumHorizontalScale (1.0f);
|
errorMessageLabel.setMinimumHorizontalScale (1.0f);
|
||||||
errorMessageLabel.setFont (12.0f);
|
errorMessageLabel.setFont (FontOptions { 12.0f });
|
||||||
errorMessageLabel.setColour (Label::textColourId, Colours::red);
|
errorMessageLabel.setColour (Label::textColourId, Colours::red);
|
||||||
errorMessageLabel.setVisible (false);
|
errorMessageLabel.setVisible (false);
|
||||||
|
|
||||||
|
|
@ -119,8 +119,8 @@ public:
|
||||||
passwordBox.setBounds (bounds.removeFromTop (textEditorHeight));
|
passwordBox.setBounds (bounds.removeFromTop (textEditorHeight));
|
||||||
bounds.removeFromTop (spacing * 2);
|
bounds.removeFromTop (spacing * 2);
|
||||||
|
|
||||||
emailBox.setFont (Font ((float) textEditorHeight / 2.5f));
|
emailBox.setFont (FontOptions ((float) textEditorHeight / 2.5f));
|
||||||
passwordBox.setFont (Font ((float) textEditorHeight / 2.5f));
|
passwordBox.setFont (FontOptions ((float) textEditorHeight / 2.5f));
|
||||||
|
|
||||||
logInButton.setBounds (bounds.removeFromTop (textEditorHeight));
|
logInButton.setBounds (bounds.removeFromTop (textEditorHeight));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public:
|
||||||
{
|
{
|
||||||
addAndMakeVisible (titleLabel);
|
addAndMakeVisible (titleLabel);
|
||||||
titleLabel.setJustificationType (Justification::centred);
|
titleLabel.setJustificationType (Justification::centred);
|
||||||
titleLabel.setFont (Font (35.0f, Font::FontStyleFlags::bold));
|
titleLabel.setFont (FontOptions (35.0f, Font::FontStyleFlags::bold));
|
||||||
|
|
||||||
auto buildDate = Time::getCompilationDate();
|
auto buildDate = Time::getCompilationDate();
|
||||||
addAndMakeVisible (versionLabel);
|
addAndMakeVisible (versionLabel);
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ private:
|
||||||
// This is unfortunately a bit slow, but will work on all platforms.
|
// This is unfortunately a bit slow, but will work on all platforms.
|
||||||
static bool isMonospacedTypeface (const String& name)
|
static bool isMonospacedTypeface (const String& name)
|
||||||
{
|
{
|
||||||
const Font font (name, 20.0f, Font::plain);
|
const Font font = FontOptions (name, 20.0f, Font::plain);
|
||||||
|
|
||||||
const auto width = font.getStringWidth ("....");
|
const auto width = font.getStringWidth ("....");
|
||||||
|
|
||||||
|
|
@ -188,7 +188,7 @@ private:
|
||||||
PropertyPanel panel;
|
PropertyPanel panel;
|
||||||
TextButton loadButton, saveButton;
|
TextButton loadButton, saveButton;
|
||||||
|
|
||||||
Font codeFont;
|
Font codeFont { FontOptions{} };
|
||||||
Array<var> colourValues;
|
Array<var> colourValues;
|
||||||
|
|
||||||
void saveScheme (bool isExit)
|
void saveScheme (bool isExit)
|
||||||
|
|
|
||||||
|
|
@ -139,17 +139,17 @@ public:
|
||||||
UpdateDialog (const String& newVersion, const String& releaseNotes)
|
UpdateDialog (const String& newVersion, const String& releaseNotes)
|
||||||
{
|
{
|
||||||
titleLabel.setText ("JUCE version " + newVersion, dontSendNotification);
|
titleLabel.setText ("JUCE version " + newVersion, dontSendNotification);
|
||||||
titleLabel.setFont ({ 15.0f, Font::bold });
|
titleLabel.setFont (FontOptions { 15.0f, Font::bold });
|
||||||
titleLabel.setJustificationType (Justification::centred);
|
titleLabel.setJustificationType (Justification::centred);
|
||||||
addAndMakeVisible (titleLabel);
|
addAndMakeVisible (titleLabel);
|
||||||
|
|
||||||
contentLabel.setText ("A new version of JUCE is available - would you like to download it?", dontSendNotification);
|
contentLabel.setText ("A new version of JUCE is available - would you like to download it?", dontSendNotification);
|
||||||
contentLabel.setFont (15.0f);
|
contentLabel.setFont (FontOptions { 15.0f });
|
||||||
contentLabel.setJustificationType (Justification::topLeft);
|
contentLabel.setJustificationType (Justification::topLeft);
|
||||||
addAndMakeVisible (contentLabel);
|
addAndMakeVisible (contentLabel);
|
||||||
|
|
||||||
releaseNotesLabel.setText ("Release notes:", dontSendNotification);
|
releaseNotesLabel.setText ("Release notes:", dontSendNotification);
|
||||||
releaseNotesLabel.setFont (15.0f);
|
releaseNotesLabel.setFont (FontOptions { 15.0f });
|
||||||
releaseNotesLabel.setJustificationType (Justification::topLeft);
|
releaseNotesLabel.setJustificationType (Justification::topLeft);
|
||||||
addAndMakeVisible (releaseNotesLabel);
|
addAndMakeVisible (releaseNotesLabel);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ void %%editor_class_name%%::paint (juce::Graphics& g)
|
||||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
||||||
|
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.setFont (15.0f);
|
g.setFont (juce::FontOptions (15.0f));
|
||||||
g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1);
|
g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ void %%editor_class_name%%::paint (juce::Graphics& g)
|
||||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
||||||
|
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.setFont (15.0f);
|
g.setFont (juce::FontOptions (15.0f));
|
||||||
g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1);
|
g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public:
|
||||||
// (Our component is opaque, so we must completely fill the background with a solid colour)
|
// (Our component is opaque, so we must completely fill the background with a solid colour)
|
||||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
||||||
|
|
||||||
g.setFont (juce::Font (16.0f));
|
g.setFont (juce::FontOptions (16.0f));
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.drawText ("Hello World!", getLocalBounds(), juce::Justification::centred, true);
|
g.drawText ("Hello World!", getLocalBounds(), juce::Justification::centred, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ void %%content_component_class%%::paint (juce::Graphics& g)
|
||||||
// (Our component is opaque, so we must completely fill the background with a solid colour)
|
// (Our component is opaque, so we must completely fill the background with a solid colour)
|
||||||
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
|
||||||
|
|
||||||
g.setFont (juce::Font (16.0f));
|
g.setFont (juce::FontOptions (16.0f));
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.drawText ("Hello World!", getLocalBounds(), juce::Justification::centred, true);
|
g.drawText ("Hello World!", getLocalBounds(), juce::Justification::centred, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public:
|
||||||
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
||||||
|
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.setFont (14.0f);
|
g.setFont (juce::FontOptions (14.0f));
|
||||||
g.drawText ("%%component_class%%", getLocalBounds(),
|
g.drawText ("%%component_class%%", getLocalBounds(),
|
||||||
juce::Justification::centred, true); // draw some placeholder text
|
juce::Justification::centred, true); // draw some placeholder text
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ void %%component_class%%::paint (juce::Graphics& g)
|
||||||
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
||||||
|
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.setFont (14.0f);
|
g.setFont (juce::FontOptions (14.0f));
|
||||||
g.drawText ("%%component_class%%", getLocalBounds(),
|
g.drawText ("%%component_class%%", getLocalBounds(),
|
||||||
juce::Justification::centred, true); // draw some placeholder text
|
juce::Justification::centred, true); // draw some placeholder text
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
||||||
|
|
||||||
g.setColour (juce::Colours::white);
|
g.setColour (juce::Colours::white);
|
||||||
g.setFont (14.0f);
|
g.setFont (juce::FontOptions (14.0f));
|
||||||
g.drawText ("%%component_class%%", getLocalBounds(),
|
g.drawText ("%%component_class%%", getLocalBounds(),
|
||||||
juce::Justification::centred, true); // draw some placeholder text
|
juce::Justification::centred, true); // draw some placeholder text
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public:
|
||||||
.getTransformToFit (contentBounds, area.toFloat()));
|
.getTransformToFit (contentBounds, area.toFloat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setFont (Font (14.0f, Font::bold));
|
g.setFont (FontOptions (14.0f, Font::bold));
|
||||||
g.setColour (findColour (defaultTextColourId));
|
g.setColour (findColour (defaultTextColourId));
|
||||||
g.drawMultiLineText (facts.joinIntoString ("\n"), 10, 15, getWidth() - 16);
|
g.drawMultiLineText (facts.joinIntoString ("\n"), 10, 15, getWidth() - 16);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public:
|
||||||
|
|
||||||
Label defaultLabel;
|
Label defaultLabel;
|
||||||
|
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
font.setHeight ((float) xml.getDoubleAttribute ("fontsize", 15.0));
|
font.setHeight ((float) xml.getDoubleAttribute ("fontsize", 15.0));
|
||||||
font.setBold (xml.getBoolAttribute ("bold", false));
|
font.setBold (xml.getBoolAttribute ("bold", false));
|
||||||
font.setItalic (xml.getBoolAttribute ("italic", false));
|
font.setItalic (xml.getBoolAttribute ("italic", false));
|
||||||
|
|
@ -703,7 +703,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Font newState, oldState;
|
Font newState { FontOptions{} }, oldState { FontOptions{} };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
PaintElementText (PaintRoutine* pr)
|
PaintElementText (PaintRoutine* pr)
|
||||||
: ColouredElement (pr, "Text", false, false),
|
: ColouredElement (pr, "Text", false, false),
|
||||||
text ("Your text goes here"),
|
text ("Your text goes here"),
|
||||||
font (15.0f),
|
font (FontOptions { 15.0f }),
|
||||||
typefaceName (FontPropertyComponent::getDefaultFont()),
|
typefaceName (FontPropertyComponent::getDefaultFont()),
|
||||||
justification (Justification::centred)
|
justification (Justification::centred)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public:
|
||||||
Colour (0xffffffff).overlaidWith (colour));
|
Colour (0xffffffff).overlaidWith (colour));
|
||||||
|
|
||||||
g.setColour (Colours::white.overlaidWith (colour).contrasting());
|
g.setColour (Colours::white.overlaidWith (colour).contrasting());
|
||||||
g.setFont (Font ((float) getHeight() * 0.6f, Font::bold));
|
g.setFont (FontOptions ((float) getHeight() * 0.6f, Font::bold));
|
||||||
g.drawFittedText (colour.toDisplayString (true),
|
g.drawFittedText (colour.toDisplayString (true),
|
||||||
2, 1, getWidth() - 4, getHeight() - 1,
|
2, 1, getWidth() - 4, getHeight() - 1,
|
||||||
Justification::centred, 1);
|
Justification::centred, 1);
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ public:
|
||||||
Array<Font> fonts;
|
Array<Font> fonts;
|
||||||
Font::findFonts (fonts);
|
Font::findFonts (fonts);
|
||||||
|
|
||||||
for (int i = 0; i < fonts.size(); ++i)
|
for (const auto& font : fonts)
|
||||||
fontNames.add (fonts[i].getTypefaceName());
|
fontNames.add (font.getTypefaceName());
|
||||||
}
|
}
|
||||||
|
|
||||||
choices.addArray (fontNames);
|
choices.addArray (fontNames);
|
||||||
|
|
@ -90,14 +90,15 @@ public:
|
||||||
|
|
||||||
static Font applyNameToFont (const String& typefaceName, const Font& font)
|
static Font applyNameToFont (const String& typefaceName, const Font& font)
|
||||||
{
|
{
|
||||||
auto extraKerning = font.getExtraKerningFactor();
|
const auto extraKerning = font.getExtraKerningFactor();
|
||||||
|
const auto kerned = [extraKerning] (Font f) { return f.withExtraKerningFactor (extraKerning); };
|
||||||
|
|
||||||
if (typefaceName == getDefaultFont()) return Font (font.getHeight(), font.getStyleFlags()).withExtraKerningFactor (extraKerning);
|
if (typefaceName == getDefaultFont()) return kerned (FontOptions (font.getHeight(), font.getStyleFlags()));
|
||||||
if (typefaceName == getDefaultSans()) return Font (Font::getDefaultSansSerifFontName(), font.getHeight(), font.getStyleFlags()).withExtraKerningFactor (extraKerning);
|
if (typefaceName == getDefaultSans()) return kerned (FontOptions (Font::getDefaultSansSerifFontName(), font.getHeight(), font.getStyleFlags()));
|
||||||
if (typefaceName == getDefaultSerif()) return Font (Font::getDefaultSerifFontName(), font.getHeight(), font.getStyleFlags()).withExtraKerningFactor (extraKerning);
|
if (typefaceName == getDefaultSerif()) return kerned (FontOptions (Font::getDefaultSerifFontName(), font.getHeight(), font.getStyleFlags()));
|
||||||
if (typefaceName == getDefaultMono()) return Font (Font::getDefaultMonospacedFontName(), font.getHeight(), font.getStyleFlags()).withExtraKerningFactor (extraKerning);
|
if (typefaceName == getDefaultMono()) return kerned (FontOptions (Font::getDefaultMonospacedFontName(), font.getHeight(), font.getStyleFlags()));
|
||||||
|
|
||||||
auto f = Font (typefaceName, font.getHeight(), font.getStyleFlags()).withExtraKerningFactor (extraKerning);
|
auto f = kerned (FontOptions { typefaceName, font.getHeight(), font.getStyleFlags() });
|
||||||
|
|
||||||
if (f.getAvailableStyles().contains (font.getTypefaceStyle()))
|
if (f.getAvailableStyles().contains (font.getTypefaceStyle()))
|
||||||
f.setTypefaceStyle (font.getTypefaceStyle());
|
f.setTypefaceStyle (font.getTypefaceStyle());
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ int ResourceEditorPanel::getColumnAutoSizeWidth (int columnId)
|
||||||
if (columnId == 4)
|
if (columnId == 4)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Font f (13.0f);
|
Font f (FontOptions { 13.0f });
|
||||||
int widest = 40;
|
int widest = 40;
|
||||||
|
|
||||||
for (int i = document.getResources().size(); --i >= 0;)
|
for (int i = document.getResources().size(); --i >= 0;)
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ struct ContentViewHeader final : public Component
|
||||||
icon.withColour (Colours::white).draw (g, bounds.toFloat().removeFromRight (30), false);
|
icon.withColour (Colours::white).draw (g, bounds.toFloat().removeFromRight (30), false);
|
||||||
|
|
||||||
g.setColour (Colours::white);
|
g.setColour (Colours::white);
|
||||||
g.setFont (Font (18.0f));
|
g.setFont (FontOptions (18.0f));
|
||||||
g.drawFittedText (name, bounds, Justification::centredLeft, 1);
|
g.drawFittedText (name, bounds, Justification::centredLeft, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ public:
|
||||||
{
|
{
|
||||||
info = infoToDisplay;
|
info = infoToDisplay;
|
||||||
|
|
||||||
auto stringWidth = roundToInt (Font (14.0f).getStringWidthFloat (info));
|
auto stringWidth = roundToInt (Font (FontOptions (14.0f)).getStringWidthFloat (info));
|
||||||
width = jmin (300, stringWidth);
|
width = jmin (300, stringWidth);
|
||||||
|
|
||||||
numLines += static_cast<int> (stringWidth / width);
|
numLines += static_cast<int> (stringWidth / width);
|
||||||
|
|
@ -238,7 +238,7 @@ private:
|
||||||
g.fillAll (findColour (secondaryBackgroundColourId));
|
g.fillAll (findColour (secondaryBackgroundColourId));
|
||||||
|
|
||||||
g.setColour (findColour (defaultTextColourId));
|
g.setColour (findColour (defaultTextColourId));
|
||||||
g.setFont (Font (14.0f));
|
g.setFont (FontOptions (14.0f));
|
||||||
g.drawFittedText (stringToDisplay, getLocalBounds(), Justification::centred, 15, 0.75f);
|
g.drawFittedText (stringToDisplay, getLocalBounds(), Justification::centred, 15, 0.75f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ public:
|
||||||
clearProperties();
|
clearProperties();
|
||||||
|
|
||||||
if (description.isNotEmpty())
|
if (description.isNotEmpty())
|
||||||
properties.push_back (std::make_unique<LabelPropertyComponent> (description, 16, Font (16.0f),
|
properties.push_back (std::make_unique<LabelPropertyComponent> (description, 16, FontOptions (16.0f),
|
||||||
Justification::centredLeft));
|
Justification::centredLeft));
|
||||||
|
|
||||||
for (auto* comp : newProps.components)
|
for (auto* comp : newProps.components)
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ HeaderComponent::HeaderComponent (ProjectContentComponent* pcc)
|
||||||
void HeaderComponent::resized()
|
void HeaderComponent::resized()
|
||||||
{
|
{
|
||||||
auto bounds = getLocalBounds();
|
auto bounds = getLocalBounds();
|
||||||
configLabel.setFont ({ (float) bounds.getHeight() / 3.0f });
|
configLabel.setFont (FontOptions { (float) bounds.getHeight() / 3.0f });
|
||||||
|
|
||||||
{
|
{
|
||||||
auto headerBounds = bounds.removeFromLeft (tabsWidth);
|
auto headerBounds = bounds.removeFromLeft (tabsWidth);
|
||||||
|
|
|
||||||
|
|
@ -179,11 +179,11 @@ private:
|
||||||
icon = (ProjectMessages::getTypeForMessage (message) == ProjectMessages::Ids::warning ? getIcons().warning : getIcons().info);
|
icon = (ProjectMessages::getTypeForMessage (message) == ProjectMessages::Ids::warning ? getIcons().warning : getIcons().info);
|
||||||
|
|
||||||
messageTitleLabel.setText (ProjectMessages::getTitleForMessage (message), dontSendNotification);
|
messageTitleLabel.setText (ProjectMessages::getTitleForMessage (message), dontSendNotification);
|
||||||
messageTitleLabel.setFont (Font (11.0f).boldened());
|
messageTitleLabel.setFont (FontOptions { 11.0f, Font::bold });
|
||||||
addAndMakeVisible (messageTitleLabel);
|
addAndMakeVisible (messageTitleLabel);
|
||||||
|
|
||||||
messageDescriptionLabel.setText (ProjectMessages::getDescriptionForMessage (message), dontSendNotification);
|
messageDescriptionLabel.setText (ProjectMessages::getDescriptionForMessage (message), dontSendNotification);
|
||||||
messageDescriptionLabel.setFont (Font (11.0f));
|
messageDescriptionLabel.setFont (FontOptions (11.0f));
|
||||||
messageDescriptionLabel.setJustificationType (Justification::topLeft);
|
messageDescriptionLabel.setJustificationType (Justification::topLeft);
|
||||||
addAndMakeVisible (messageDescriptionLabel);
|
addAndMakeVisible (messageDescriptionLabel);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ bool AppearanceSettings::writeToFile (const File& file) const
|
||||||
|
|
||||||
Font AppearanceSettings::getDefaultCodeFont()
|
Font AppearanceSettings::getDefaultCodeFont()
|
||||||
{
|
{
|
||||||
return Font (Font::getDefaultMonospacedFontName(), Font::getDefaultStyle(), 13.0f);
|
return FontOptions (Font::getDefaultMonospacedFontName(), Font::getDefaultStyle(), 13.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringArray AppearanceSettings::getColourNames() const
|
StringArray AppearanceSettings::getColourNames() const
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ private:
|
||||||
Colour (0xffffffff).overlaidWith (colour));
|
Colour (0xffffffff).overlaidWith (colour));
|
||||||
|
|
||||||
g.setColour (Colours::white.overlaidWith (colour).contrasting());
|
g.setColour (Colours::white.overlaidWith (colour).contrasting());
|
||||||
g.setFont (Font ((float) getHeight() * 0.6f, Font::bold));
|
g.setFont (FontOptions ((float) getHeight() * 0.6f, Font::bold));
|
||||||
g.drawFittedText (colour.toDisplayString (true), getLocalBounds().reduced (2, 1),
|
g.drawFittedText (colour.toDisplayString (true), getLocalBounds().reduced (2, 1),
|
||||||
Justification::centred, 1);
|
Justification::centred, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class LabelPropertyComponent final : public PropertyComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LabelPropertyComponent (const String& labelText, int propertyHeight = 25,
|
LabelPropertyComponent (const String& labelText, int propertyHeight = 25,
|
||||||
Font labelFont = Font (16.0f, Font::bold),
|
Font labelFont = FontOptions (16.0f, Font::bold),
|
||||||
Justification labelJustification = Justification::centred)
|
Justification labelJustification = Justification::centred)
|
||||||
: PropertyComponent (labelText),
|
: PropertyComponent (labelText),
|
||||||
labelToDisplay ({}, labelText)
|
labelToDisplay ({}, labelText)
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void JucerTreeViewBase::refreshSubItems()
|
||||||
|
|
||||||
Font JucerTreeViewBase::getFont() const
|
Font JucerTreeViewBase::getFont() const
|
||||||
{
|
{
|
||||||
return Font ((float) getItemHeight() * 0.6f);
|
return FontOptions ((float) getItemHeight() * 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour /*backgroundColour*/, bool isMouseOver)
|
void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour /*backgroundColour*/, bool isMouseOver)
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
bool filled, Justification justification);
|
bool filled, Justification justification);
|
||||||
static Path getChoiceComponentArrowPath (Rectangle<float> arrowZone);
|
static Path getChoiceComponentArrowPath (Rectangle<float> arrowZone);
|
||||||
|
|
||||||
static Font getPropertyComponentFont() { return { 14.0f, Font::FontStyleFlags::bold }; }
|
static Font getPropertyComponentFont() { return FontOptions { 14.0f, Font::FontStyleFlags::bold }; }
|
||||||
static int getTextWidthForPropertyComponent (const PropertyComponent& pc) { return jmin (200, pc.getWidth() / 2); }
|
static int getTextWidthForPropertyComponent (const PropertyComponent& pc) { return jmin (200, pc.getWidth() / 2); }
|
||||||
|
|
||||||
static ColourScheme getProjucerDarkColourScheme()
|
static ColourScheme getProjucerDarkColourScheme()
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public:
|
||||||
g.setColour (isBlacklisted ? Colours::red
|
g.setColour (isBlacklisted ? Colours::red
|
||||||
: columnId == nameCol ? defaultTextColour
|
: columnId == nameCol ? defaultTextColour
|
||||||
: defaultTextColour.interpolatedWith (Colours::transparentBlack, 0.3f));
|
: defaultTextColour.interpolatedWith (Colours::transparentBlack, 0.3f));
|
||||||
g.setFont (Font ((float) height * 0.7f, Font::bold));
|
g.setFont (FontOptions ((float) height * 0.7f, Font::bold));
|
||||||
g.drawFittedText (text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f);
|
g.drawFittedText (text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ static void drawTextLayout (Graphics& g, Component& owner, StringRef text, const
|
||||||
|
|
||||||
AttributedString attributedString { text };
|
AttributedString attributedString { text };
|
||||||
attributedString.setColour (textColour);
|
attributedString.setColour (textColour);
|
||||||
attributedString.setFont ((float) textBounds.getHeight() * 0.6f);
|
attributedString.setFont (FontOptions { (float) textBounds.getHeight() * 0.6f });
|
||||||
attributedString.setJustification (Justification::centredLeft);
|
attributedString.setJustification (Justification::centredLeft);
|
||||||
attributedString.setWordWrap (AttributedString::WordWrap::none);
|
attributedString.setWordWrap (AttributedString::WordWrap::none);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ void MPEKeyboardComponent::drawWhiteKey (int midiNoteNumber, Graphics& g, Rectan
|
||||||
auto text = MidiMessage::getMidiNoteName (midiNoteNumber, true, true, getOctaveForMiddleC());
|
auto text = MidiMessage::getMidiNoteName (midiNoteNumber, true, true, getOctaveForMiddleC());
|
||||||
|
|
||||||
g.setColour (findColour (textLabelColourId));
|
g.setColour (findColour (textLabelColourId));
|
||||||
g.setFont (Font (fontHeight).withHorizontalScale (0.8f));
|
g.setFont (Font (FontOptions { fontHeight }).withHorizontalScale (0.8f));
|
||||||
|
|
||||||
switch (getOrientation())
|
switch (getOrientation())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ void MidiKeyboardComponent::drawWhiteNote (int midiNoteNumber, Graphics& g, Rect
|
||||||
auto fontHeight = jmin (12.0f, getKeyWidth() * 0.9f);
|
auto fontHeight = jmin (12.0f, getKeyWidth() * 0.9f);
|
||||||
|
|
||||||
g.setColour (textColour);
|
g.setColour (textColour);
|
||||||
g.setFont (Font (fontHeight).withHorizontalScale (0.8f));
|
g.setFont (Font (FontOptions { fontHeight }).withHorizontalScale (0.8f));
|
||||||
|
|
||||||
switch (currentOrientation)
|
switch (currentOrientation)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ void Graphics::resetToDefaultState()
|
||||||
{
|
{
|
||||||
saveStateIfPending();
|
saveStateIfPending();
|
||||||
context.setFill (FillType());
|
context.setFill (FillType());
|
||||||
context.setFont (Font());
|
context.setFont (FontOptions{});
|
||||||
context.setInterpolationQuality (Graphics::mediumResamplingQuality);
|
context.setInterpolationQuality (Graphics::mediumResamplingQuality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ protected:
|
||||||
RectangleList<int> clip;
|
RectangleList<int> clip;
|
||||||
int xOffset, yOffset;
|
int xOffset, yOffset;
|
||||||
FillType fillType;
|
FillType fillType;
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
};
|
};
|
||||||
|
|
||||||
OwnedArray<SavedState> stateStack;
|
OwnedArray<SavedState> stateStack;
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace
|
||||||
{
|
{
|
||||||
if (atts.size() == 0)
|
if (atts.size() == 0)
|
||||||
{
|
{
|
||||||
atts.add ({ Range<int> (0, length), f != nullptr ? *f : Font(), c != nullptr ? *c : Colour (0xff000000) });
|
atts.add ({ Range<int> (0, length), f != nullptr ? *f : FontOptions{}, c != nullptr ? *c : Colour (0xff000000) });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ public:
|
||||||
Range<int> range;
|
Range<int> range;
|
||||||
|
|
||||||
/** The font for this range of characters. */
|
/** The font for this range of characters. */
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
|
|
||||||
/** The colour for this range of characters. */
|
/** The colour for this range of characters. */
|
||||||
Colour colour { 0xff000000 };
|
Colour colour { 0xff000000 };
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,11 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
Font::Font (FontOptions opt)
|
||||||
|
: font (new SharedFontInternal (std::move (opt)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Font::Font() : font (new SharedFontInternal (FontOptions{})) {}
|
Font::Font() : font (new SharedFontInternal (FontOptions{})) {}
|
||||||
Font::Font (const Typeface::Ptr& typeface) : font (new SharedFontInternal (FontOptions { typeface })) {}
|
Font::Font (const Typeface::Ptr& typeface) : font (new SharedFontInternal (FontOptions { typeface })) {}
|
||||||
Font::Font (const Font& other) noexcept : font (other.font) {}
|
Font::Font (const Font& other) noexcept : font (other.font) {}
|
||||||
|
|
@ -747,7 +752,7 @@ void Font::findFonts (Array<Font>& destArray)
|
||||||
if (! styles.contains (style, true))
|
if (! styles.contains (style, true))
|
||||||
style = styles[0];
|
style = styles[0];
|
||||||
|
|
||||||
destArray.add (Font (name, style, FontValues::defaultFontHeight));
|
destArray.add (FontOptions (name, style, FontValues::defaultFontHeight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -851,7 +856,7 @@ Font Font::fromString (const String& fontDescription)
|
||||||
|
|
||||||
const String style (sizeAndStyle.fromFirstOccurrenceOf (" ", false, false));
|
const String style (sizeAndStyle.fromFirstOccurrenceOf (" ", false, false));
|
||||||
|
|
||||||
return Font (name, style, height);
|
return FontOptions (name, style, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::Native Font::getNativeDetails() const
|
Font::Native Font::getNativeDetails() const
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,9 @@ public:
|
||||||
underlined = 4 /**< underlines the font. @see setStyleFlags */
|
underlined = 4 /**< underlines the font. @see setStyleFlags */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Constructs a Font from a set of options describing the font. */
|
||||||
|
Font (FontOptions options);
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** Creates a sans-serif font in a given size.
|
/** Creates a sans-serif font in a given size.
|
||||||
|
|
||||||
|
|
@ -70,6 +73,7 @@ public:
|
||||||
just Font::plain for the normal style.
|
just Font::plain for the normal style.
|
||||||
@see FontStyleFlags, getDefaultSansSerifFontName
|
@see FontStyleFlags, getDefaultSansSerifFontName
|
||||||
*/
|
*/
|
||||||
|
[[deprecated ("Use the constructor that takes a FontOptions argument")]]
|
||||||
Font (float fontHeight, int styleFlags = plain);
|
Font (float fontHeight, int styleFlags = plain);
|
||||||
|
|
||||||
/** Creates a font with a given typeface and parameters.
|
/** Creates a font with a given typeface and parameters.
|
||||||
|
|
@ -81,6 +85,7 @@ public:
|
||||||
just Font::plain for the normal style.
|
just Font::plain for the normal style.
|
||||||
@see FontStyleFlags, getDefaultSansSerifFontName
|
@see FontStyleFlags, getDefaultSansSerifFontName
|
||||||
*/
|
*/
|
||||||
|
[[deprecated ("Use the constructor that takes a FontOptions argument")]]
|
||||||
Font (const String& typefaceName, float fontHeight, int styleFlags);
|
Font (const String& typefaceName, float fontHeight, int styleFlags);
|
||||||
|
|
||||||
/** Creates a font with a given typeface and parameters.
|
/** Creates a font with a given typeface and parameters.
|
||||||
|
|
@ -89,12 +94,11 @@ public:
|
||||||
@param typefaceStyle the font style of the typeface to use
|
@param typefaceStyle the font style of the typeface to use
|
||||||
@param fontHeight the height in pixels (can be fractional)
|
@param fontHeight the height in pixels (can be fractional)
|
||||||
*/
|
*/
|
||||||
|
[[deprecated ("Use the constructor that takes a FontOptions argument")]]
|
||||||
Font (const String& typefaceName, const String& typefaceStyle, float fontHeight);
|
Font (const String& typefaceName, const String& typefaceStyle, float fontHeight);
|
||||||
|
|
||||||
/** Creates a copy of another Font object. */
|
|
||||||
Font (const Font& other) noexcept;
|
|
||||||
|
|
||||||
/** Creates a font for a typeface. */
|
/** Creates a font for a typeface. */
|
||||||
|
[[deprecated ("Use the constructor that takes a FontOptions argument")]]
|
||||||
Font (const Typeface::Ptr& typeface);
|
Font (const Typeface::Ptr& typeface);
|
||||||
|
|
||||||
/** Creates a basic sans-serif font at a default height.
|
/** Creates a basic sans-serif font at a default height.
|
||||||
|
|
@ -103,8 +107,12 @@ public:
|
||||||
on drawing with - this constructor is here to help initialise objects before changing
|
on drawing with - this constructor is here to help initialise objects before changing
|
||||||
the font's settings later.
|
the font's settings later.
|
||||||
*/
|
*/
|
||||||
|
[[deprecated ("Use the constructor that takes a FontOptions argument")]]
|
||||||
Font();
|
Font();
|
||||||
|
|
||||||
|
/** Creates a copy of another Font object. */
|
||||||
|
Font (const Font& other) noexcept;
|
||||||
|
|
||||||
/** Move constructor */
|
/** Move constructor */
|
||||||
Font (Font&& other) noexcept;
|
Font (Font&& other) noexcept;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ public:
|
||||||
private:
|
private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
friend class GlyphArrangement;
|
friend class GlyphArrangement;
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
juce_wchar character;
|
juce_wchar character;
|
||||||
int glyph;
|
int glyph;
|
||||||
float x, y, w;
|
float x, y, w;
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ public:
|
||||||
/** Returns the X position range which contains all the glyphs in this run. */
|
/** Returns the X position range which contains all the glyphs in this run. */
|
||||||
Range<float> getRunBoundsX() const noexcept;
|
Range<float> getRunBoundsX() const noexcept;
|
||||||
|
|
||||||
Font font; /**< The run's font. */
|
Font font { FontOptions{} }; /**< The run's font. */
|
||||||
Colour colour { 0xff000000 }; /**< The run's colour. */
|
Colour colour { 0xff000000 }; /**< The run's colour. */
|
||||||
Array<Glyph> glyphs; /**< The glyphs in this run. */
|
Array<Glyph> glyphs; /**< The glyphs in this run. */
|
||||||
Range<int> stringRange; /**< The character range that this run represents in the
|
Range<int> stringRange; /**< The character range that this run represents in the
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ struct FontStyleHelpers
|
||||||
private:
|
private:
|
||||||
static String findName (const String& placeholder)
|
static String findName (const String& placeholder)
|
||||||
{
|
{
|
||||||
const Font f (placeholder, 15.0f, Font::plain);
|
const Font f (FontOptions (placeholder, 15.0f, Font::plain));
|
||||||
return Font::getDefaultTypefaceForFont (f)->getName();
|
return Font::getDefaultTypefaceForFont (f)->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -957,7 +957,7 @@ public:
|
||||||
|
|
||||||
beginTest ("Typefaces loaded from memory are found when creating font instances by name");
|
beginTest ("Typefaces loaded from memory are found when creating font instances by name");
|
||||||
{
|
{
|
||||||
Font font (ptr->getName(), ptr->getStyle(), 12.0f);
|
Font font (FontOptions (ptr->getName(), ptr->getStyle(), 12.0f));
|
||||||
|
|
||||||
expect (font.getTypefacePtr() != nullptr);
|
expect (font.getTypefacePtr() != nullptr);
|
||||||
expect (font.getTypefacePtr()->getName() == ptr->getName());
|
expect (font.getTypefacePtr()->getName() == ptr->getName());
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ struct CoreGraphicsContext::SavedState
|
||||||
}
|
}
|
||||||
|
|
||||||
FillType fillType;
|
FillType fillType;
|
||||||
Font font { 1.0f };
|
Font font { FontOptions { 1.0f } };
|
||||||
CFUniquePtr<CTFontRef> fontRef{};
|
CFUniquePtr<CTFontRef> fontRef{};
|
||||||
CGAffineTransform textMatrix = CGAffineTransformIdentity,
|
CGAffineTransform textMatrix = CGAffineTransformIdentity,
|
||||||
inverseTextMatrix = CGAffineTransformIdentity;
|
inverseTextMatrix = CGAffineTransformIdentity;
|
||||||
|
|
@ -244,7 +244,7 @@ CoreGraphicsContext::CoreGraphicsContext (CGContextRef c, float h)
|
||||||
CGContextSetBlendMode (context.get(), kCGBlendModeNormal);
|
CGContextSetBlendMode (context.get(), kCGBlendModeNormal);
|
||||||
rgbColourSpace.reset (CGColorSpaceCreateWithName (kCGColorSpaceSRGB));
|
rgbColourSpace.reset (CGColorSpaceCreateWithName (kCGColorSpaceSRGB));
|
||||||
greyColourSpace.reset (CGColorSpaceCreateWithName (kCGColorSpaceGenericGrayGamma2_2));
|
greyColourSpace.reset (CGColorSpaceCreateWithName (kCGColorSpaceGenericGrayGamma2_2));
|
||||||
setFont (Font());
|
setFont (FontOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreGraphicsContext::~CoreGraphicsContext()
|
CoreGraphicsContext::~CoreGraphicsContext()
|
||||||
|
|
|
||||||
|
|
@ -437,9 +437,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ComSmartPtr<ID2D1Factory> getD2D1Factory() const { return d2dFactory; }
|
|
||||||
[[nodiscard]] ComSmartPtr<IDWriteFactory> getDWriteFactory() const { return directWriteFactory; }
|
[[nodiscard]] ComSmartPtr<IDWriteFactory> getDWriteFactory() const { return directWriteFactory; }
|
||||||
[[nodiscard]] ComSmartPtr<ID2D1DCRenderTarget> getD2D1DCRenderTarget() const { return directWriteRenderTarget; }
|
|
||||||
[[nodiscard]] AggregateFontCollection& getFonts() { jassert (fonts.has_value()); return *fonts; }
|
[[nodiscard]] AggregateFontCollection& getFonts() { jassert (fonts.has_value()); return *fonts; }
|
||||||
[[nodiscard]] ComSmartPtr<IDWriteFontCollectionLoader> getCollectionLoader() const { return collectionLoader; }
|
[[nodiscard]] ComSmartPtr<IDWriteFontCollectionLoader> getCollectionLoader() const { return collectionLoader; }
|
||||||
|
|
||||||
|
|
@ -510,7 +508,12 @@ public:
|
||||||
HbFont hbFont { hb_font_create (hbFace.get()) };
|
HbFont hbFont { hb_font_create (hbFace.get()) };
|
||||||
|
|
||||||
FontStyleHelpers::initSynthetics (hbFont.get(), f);
|
FontStyleHelpers::initSynthetics (hbFont.get(), f);
|
||||||
return new WindowsDirectWriteTypeface (name, style, dwFont, dwFontFace, std::move (hbFont));
|
return new WindowsDirectWriteTypeface (name,
|
||||||
|
style,
|
||||||
|
dwFont,
|
||||||
|
dwFontFace,
|
||||||
|
std::move (hbFont),
|
||||||
|
getDwriteMetrics (dwFontFace));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Typeface::Ptr from (Span<const std::byte> blob)
|
static Typeface::Ptr from (Span<const std::byte> blob)
|
||||||
|
|
@ -520,7 +523,7 @@ public:
|
||||||
|
|
||||||
Native getNativeDetails() const override
|
Native getNativeDetails() const override
|
||||||
{
|
{
|
||||||
return Native { hbFont.get() };
|
return Native { hbFont.get(), nonPortableMetrics };
|
||||||
}
|
}
|
||||||
|
|
||||||
Typeface::Ptr createSystemFallback (const String& c, const String& language) const override
|
Typeface::Ptr createSystemFallback (const String& c, const String& language) const override
|
||||||
|
|
@ -687,8 +690,16 @@ private:
|
||||||
const auto style = getLocalisedStyle (*dwFont);
|
const auto style = getLocalisedStyle (*dwFont);
|
||||||
|
|
||||||
const HbFace hbFace { hb_directwrite_face_create (dwFontFace) };
|
const HbFace hbFace { hb_directwrite_face_create (dwFontFace) };
|
||||||
|
HbFont font { hb_font_create (hbFace.get()) };
|
||||||
|
const auto metrics = getGdiMetrics (font.get()).value_or (getDwriteMetrics (dwFontFace));
|
||||||
|
|
||||||
return new WindowsDirectWriteTypeface (name, style, dwFont, dwFontFace, HbFont { hb_font_create (hbFace.get()) }, std::move (customFontCollection));
|
return new WindowsDirectWriteTypeface (name,
|
||||||
|
style,
|
||||||
|
dwFont,
|
||||||
|
dwFontFace,
|
||||||
|
std::move (font),
|
||||||
|
metrics,
|
||||||
|
customFontCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getLocalisedFamilyName (IDWriteFont& font)
|
static String getLocalisedFamilyName (IDWriteFont& font)
|
||||||
|
|
@ -723,22 +734,45 @@ private:
|
||||||
ComSmartPtr<IDWriteFont> font,
|
ComSmartPtr<IDWriteFont> font,
|
||||||
ComSmartPtr<IDWriteFontFace> face,
|
ComSmartPtr<IDWriteFontFace> face,
|
||||||
HbFont hbFontIn,
|
HbFont hbFontIn,
|
||||||
|
TypefaceAscentDescent metrics,
|
||||||
ComSmartPtr<IDWriteFontCollection> collectionIn = nullptr)
|
ComSmartPtr<IDWriteFontCollection> collectionIn = nullptr)
|
||||||
: Typeface (name, style),
|
: Typeface (name, style),
|
||||||
collection (std::move (collectionIn)),
|
collection (std::move (collectionIn)),
|
||||||
dwFont (font),
|
dwFont (font),
|
||||||
dwFontFace (face),
|
dwFontFace (face),
|
||||||
hbFont (std::move (hbFontIn))
|
hbFont (std::move (hbFontIn)),
|
||||||
|
nonPortableMetrics (metrics)
|
||||||
{
|
{
|
||||||
if (collection != nullptr)
|
if (collection != nullptr)
|
||||||
factories->getFonts().addCollection (collection);
|
factories->getFonts().addCollection (collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TypefaceAscentDescent getDwriteMetrics (ComSmartPtr<IDWriteFontFace> face)
|
||||||
|
{
|
||||||
|
DWRITE_FONT_METRICS dwriteFontMetrics{};
|
||||||
|
face->GetMetrics (&dwriteFontMetrics);
|
||||||
|
return TypefaceAscentDescent { (float) dwriteFontMetrics.ascent / (float) dwriteFontMetrics.designUnitsPerEm,
|
||||||
|
(float) dwriteFontMetrics.descent / (float) dwriteFontMetrics.designUnitsPerEm };
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::optional<TypefaceAscentDescent> getGdiMetrics (hb_font_t* font)
|
||||||
|
{
|
||||||
|
hb_position_t ascent{}, descent{};
|
||||||
|
|
||||||
|
if (! hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT, &ascent) ||
|
||||||
|
! hb_ot_metrics_get_position (font, HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT, &descent))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
const auto upem = (float) hb_face_get_upem (hb_font_get_face (font));
|
||||||
|
return TypefaceAscentDescent { (float) ascent / upem, (float) descent / upem };
|
||||||
|
}
|
||||||
|
|
||||||
SharedResourcePointer<Direct2DFactories> factories;
|
SharedResourcePointer<Direct2DFactories> factories;
|
||||||
ComSmartPtr<IDWriteFontCollection> collection;
|
ComSmartPtr<IDWriteFontCollection> collection;
|
||||||
ComSmartPtr<IDWriteFont> dwFont;
|
ComSmartPtr<IDWriteFont> dwFont;
|
||||||
ComSmartPtr<IDWriteFontFace> dwFontFace;
|
ComSmartPtr<IDWriteFontFace> dwFontFace;
|
||||||
HbFont hbFont;
|
HbFont hbFont;
|
||||||
|
TypefaceAscentDescent nonPortableMetrics;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DefaultFontNames
|
struct DefaultFontNames
|
||||||
|
|
|
||||||
|
|
@ -95,10 +95,18 @@ DECLARE_JNI_CLASS (AndroidAssetManager, "android/content/res/AssetManager")
|
||||||
// Defined in juce_core
|
// Defined in juce_core
|
||||||
std::unique_ptr<InputStream> makeAndroidInputStreamWrapper (jobject stream);
|
std::unique_ptr<InputStream> makeAndroidInputStreamWrapper (jobject stream);
|
||||||
|
|
||||||
|
struct AndroidCachedTypeface
|
||||||
|
{
|
||||||
|
std::shared_ptr<hb_font_t> font;
|
||||||
|
TypefaceAscentDescent nonPortableMetrics;
|
||||||
|
};
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class MemoryFontCache : public DeletedAtShutdown
|
class MemoryFontCache : public DeletedAtShutdown
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using Value = AndroidCachedTypeface;
|
||||||
|
|
||||||
~MemoryFontCache()
|
~MemoryFontCache()
|
||||||
{
|
{
|
||||||
clearSingletonInstance();
|
clearSingletonInstance();
|
||||||
|
|
@ -112,10 +120,10 @@ public:
|
||||||
bool operator== (const Key& other) const { return tie() == other.tie(); }
|
bool operator== (const Key& other) const { return tie() == other.tie(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
void add (const Key& key, std::shared_ptr<hb_font_t> ptr)
|
void add (const Key& key, const Value& value)
|
||||||
{
|
{
|
||||||
const std::scoped_lock lock { mutex };
|
const std::scoped_lock lock { mutex };
|
||||||
cache.emplace (key, ptr);
|
cache.emplace (key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove (const Key& p)
|
void remove (const Key& p)
|
||||||
|
|
@ -156,7 +164,7 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<hb_font_t> find (const Key& key)
|
std::optional<Value> find (const Key& key) const
|
||||||
{
|
{
|
||||||
const std::scoped_lock lock { mutex };
|
const std::scoped_lock lock { mutex };
|
||||||
|
|
||||||
|
|
@ -165,13 +173,13 @@ public:
|
||||||
if (iter != cache.end())
|
if (iter != cache.end())
|
||||||
return iter->second;
|
return iter->second;
|
||||||
|
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
JUCE_DECLARE_SINGLETON (MemoryFontCache, true)
|
JUCE_DECLARE_SINGLETON (MemoryFontCache, true)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<Key, std::shared_ptr<hb_font_t>> cache;
|
std::map<Key, Value> cache;
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -223,13 +231,19 @@ StringArray Font::findAllTypefaceStyles (const String& family)
|
||||||
class AndroidTypeface final : public Typeface
|
class AndroidTypeface final : public Typeface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum class DoCache
|
||||||
|
{
|
||||||
|
no,
|
||||||
|
yes
|
||||||
|
};
|
||||||
|
|
||||||
static Typeface::Ptr from (const Font& font)
|
static Typeface::Ptr from (const Font& font)
|
||||||
{
|
{
|
||||||
if (auto* cache = MemoryFontCache::getInstance())
|
if (auto* cache = MemoryFontCache::getInstance())
|
||||||
if (auto result = cache->find ({ font.getTypefaceName(), font.getTypefaceStyle() }))
|
if (auto result = cache->find ({ font.getTypefaceName(), font.getTypefaceStyle() }))
|
||||||
return new AndroidTypeface (DoCache::no, result, font.getTypefaceName(), font.getTypefaceStyle());
|
return new AndroidTypeface (DoCache::no, result->font, result->nonPortableMetrics, font.getTypefaceName(), font.getTypefaceStyle());
|
||||||
|
|
||||||
auto blob = getBlobForFont (font);
|
auto [blob, metrics] = getBlobForFont (font);
|
||||||
auto face = FontStyleHelpers::getFaceForBlob ({ static_cast<const char*> (blob.getData()), blob.getSize() }, 0);
|
auto face = FontStyleHelpers::getFaceForBlob ({ static_cast<const char*> (blob.getData()), blob.getSize() }, 0);
|
||||||
|
|
||||||
if (face == nullptr)
|
if (face == nullptr)
|
||||||
|
|
@ -241,15 +255,9 @@ public:
|
||||||
HbFont hbFont { hb_font_create (face.get()) };
|
HbFont hbFont { hb_font_create (face.get()) };
|
||||||
FontStyleHelpers::initSynthetics (hbFont.get(), font);
|
FontStyleHelpers::initSynthetics (hbFont.get(), font);
|
||||||
|
|
||||||
return new AndroidTypeface (DoCache::no, std::move (hbFont), font.getTypefaceName(), font.getTypefaceStyle());
|
return new AndroidTypeface (DoCache::no, std::move (hbFont), metrics, font.getTypefaceName(), font.getTypefaceStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class DoCache
|
|
||||||
{
|
|
||||||
no,
|
|
||||||
yes
|
|
||||||
};
|
|
||||||
|
|
||||||
static Typeface::Ptr from (Span<const std::byte> blob, unsigned int index = 0)
|
static Typeface::Ptr from (Span<const std::byte> blob, unsigned int index = 0)
|
||||||
{
|
{
|
||||||
return fromMemory (DoCache::yes, blob, index);
|
return fromMemory (DoCache::yes, blob, index);
|
||||||
|
|
@ -257,7 +265,7 @@ public:
|
||||||
|
|
||||||
Native getNativeDetails() const override
|
Native getNativeDetails() const override
|
||||||
{
|
{
|
||||||
return Native { hbFont.get() };
|
return Native { hbFont.get(), nonPortableMetrics };
|
||||||
}
|
}
|
||||||
|
|
||||||
Typeface::Ptr createSystemFallback (const String& text, const String& language) const override
|
Typeface::Ptr createSystemFallback (const String& text, const String& language) const override
|
||||||
|
|
@ -342,7 +350,7 @@ private:
|
||||||
// If the font only uses unsupported colour technologies, assume it's the system emoji font
|
// If the font only uses unsupported colour technologies, assume it's the system emoji font
|
||||||
// and try to return a compatible version of the font
|
// and try to return a compatible version of the font
|
||||||
if (tech != 0 && ! hasSupportedColours)
|
if (tech != 0 && ! hasSupportedColours)
|
||||||
if (auto fallback = from ({ "NotoColorEmojiLegacy", FontValues::defaultFontHeight, Font::plain }); fallback != nullptr)
|
if (auto fallback = from (FontOptions { "NotoColorEmojiLegacy", FontValues::defaultFontHeight, Font::plain }); fallback != nullptr)
|
||||||
return fallback;
|
return fallback;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -355,10 +363,13 @@ private:
|
||||||
if (face == nullptr)
|
if (face == nullptr)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
const auto metrics = findNonPortableMetricsForData (blob);
|
||||||
|
|
||||||
return new AndroidTypeface (cache,
|
return new AndroidTypeface (cache,
|
||||||
HbFont { hb_font_create (face.get()) },
|
HbFont { hb_font_create (face.get()) },
|
||||||
|
metrics,
|
||||||
readFontName (face.get(), HB_OT_NAME_ID_FONT_FAMILY, nullptr),
|
readFontName (face.get(), HB_OT_NAME_ID_FONT_FAMILY, nullptr),
|
||||||
{});
|
readFontName (face.get(), HB_OT_NAME_ID_FONT_SUBFAMILY, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static String readFontName (hb_face_t* face, hb_ot_name_id_t nameId, hb_language_t language)
|
static String readFontName (hb_face_t* face, hb_ot_name_id_t nameId, hb_language_t language)
|
||||||
|
|
@ -372,22 +383,27 @@ private:
|
||||||
return nameString.data();
|
return nameString.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidTypeface (DoCache cache, std::shared_ptr<hb_font_t> fontIn, const String& name, const String& style)
|
AndroidTypeface (DoCache cache,
|
||||||
|
std::shared_ptr<hb_font_t> fontIn,
|
||||||
|
TypefaceAscentDescent nonPortableMetricsIn,
|
||||||
|
const String& name,
|
||||||
|
const String& style)
|
||||||
: Typeface (name, style),
|
: Typeface (name, style),
|
||||||
hbFont (std::move (fontIn)),
|
hbFont (std::move (fontIn)),
|
||||||
doCache (cache)
|
doCache (cache),
|
||||||
|
nonPortableMetrics (nonPortableMetricsIn)
|
||||||
{
|
{
|
||||||
if (doCache == DoCache::yes)
|
if (doCache == DoCache::yes)
|
||||||
if (auto* c = MemoryFontCache::getInstance())
|
if (auto* c = MemoryFontCache::getInstance())
|
||||||
c->add ({ name, style }, hbFont);
|
c->add ({ name, style }, { hbFont, nonPortableMetrics });
|
||||||
}
|
}
|
||||||
|
|
||||||
static MemoryBlock getBlobForFont (const Font& font)
|
static std::tuple<MemoryBlock, TypefaceAscentDescent> getBlobForFont (const Font& font)
|
||||||
{
|
{
|
||||||
auto memory = loadFontAsset (font.getTypefaceName());
|
auto memory = loadFontAsset (font.getTypefaceName());
|
||||||
|
|
||||||
if (! memory.isEmpty())
|
if (! memory.isEmpty())
|
||||||
return memory;
|
return std::tuple (memory, findNonPortableMetricsForAsset (font.getTypefaceName()));
|
||||||
|
|
||||||
const auto file = findFontFile (font);
|
const auto file = findFontFile (font);
|
||||||
|
|
||||||
|
|
@ -403,7 +419,7 @@ private:
|
||||||
MemoryBlock result;
|
MemoryBlock result;
|
||||||
stream.readIntoMemoryBlock (result);
|
stream.readIntoMemoryBlock (result);
|
||||||
|
|
||||||
return stream.isExhausted() ? result : MemoryBlock{};
|
return std::tuple (stream.isExhausted() ? result : MemoryBlock{}, findNonPortableMetricsForFile (file));
|
||||||
}
|
}
|
||||||
|
|
||||||
static File findFontFile (const Font& font)
|
static File findFontFile (const Font& font)
|
||||||
|
|
@ -432,14 +448,14 @@ private:
|
||||||
{
|
{
|
||||||
auto* env = getEnv();
|
auto* env = getEnv();
|
||||||
|
|
||||||
const LocalRef<jobject> assetManager { env->CallObjectMethod (getAppContext().get(), AndroidContext.getAssets) };
|
const LocalRef assetManager { env->CallObjectMethod (getAppContext().get(), AndroidContext.getAssets) };
|
||||||
|
|
||||||
if (assetManager == nullptr)
|
if (assetManager == nullptr)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const LocalRef<jobject> inputStream { env->CallObjectMethod (assetManager,
|
const LocalRef inputStream { env->CallObjectMethod (assetManager,
|
||||||
AndroidAssetManager.open,
|
AndroidAssetManager.open,
|
||||||
javaString ("fonts/" + typefaceName).get()) };
|
javaString ("fonts/" + typefaceName).get()) };
|
||||||
|
|
||||||
// Opening an input stream for an asset might throw if the asset isn't found
|
// Opening an input stream for an asset might throw if the asset isn't found
|
||||||
jniCheckHasExceptionOccurredAndClear();
|
jniCheckHasExceptionOccurredAndClear();
|
||||||
|
|
@ -458,8 +474,111 @@ private:
|
||||||
return streamWrapper->isExhausted() ? result : MemoryBlock{};
|
return streamWrapper->isExhausted() ? result : MemoryBlock{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static File getCacheFileForData (Span<const std::byte> data)
|
||||||
|
{
|
||||||
|
static CriticalSection cs;
|
||||||
|
static std::map<String, File> cache;
|
||||||
|
|
||||||
|
JNIEnv* const env = getEnv();
|
||||||
|
|
||||||
|
const auto key = [&]
|
||||||
|
{
|
||||||
|
LocalRef digest (env->CallStaticObjectMethod (JavaMessageDigest, JavaMessageDigest.getInstance, javaString ("MD5").get()));
|
||||||
|
LocalRef bytes (env->NewByteArray ((int) data.size()));
|
||||||
|
|
||||||
|
jboolean ignore;
|
||||||
|
auto* jbytes = env->GetByteArrayElements (bytes.get(), &ignore);
|
||||||
|
memcpy (jbytes, data.data(), data.size());
|
||||||
|
env->ReleaseByteArrayElements (bytes.get(), jbytes, 0);
|
||||||
|
|
||||||
|
env->CallVoidMethod (digest.get(), JavaMessageDigest.update, bytes.get());
|
||||||
|
LocalRef result ((jbyteArray) env->CallObjectMethod (digest.get(), JavaMessageDigest.digest));
|
||||||
|
auto* md5Bytes = env->GetByteArrayElements (result.get(), &ignore);
|
||||||
|
const ScopeGuard scope { [&] { env->ReleaseByteArrayElements (result.get(), md5Bytes, 0); } };
|
||||||
|
|
||||||
|
return String::toHexString (md5Bytes, env->GetArrayLength (result.get()), 0);
|
||||||
|
}();
|
||||||
|
|
||||||
|
const ScopedLock lock (cs);
|
||||||
|
auto& mapEntry = cache[key];
|
||||||
|
|
||||||
|
if (mapEntry == File())
|
||||||
|
{
|
||||||
|
static const File cacheDirectory = []
|
||||||
|
{
|
||||||
|
auto appContext = getAppContext();
|
||||||
|
|
||||||
|
if (appContext == nullptr)
|
||||||
|
return File{};
|
||||||
|
|
||||||
|
auto* localEnv = getEnv();
|
||||||
|
|
||||||
|
LocalRef cacheFile (localEnv->CallObjectMethod (appContext.get(), AndroidContext.getCacheDir));
|
||||||
|
LocalRef jPath ((jstring) localEnv->CallObjectMethod (cacheFile.get(), JavaFile.getAbsolutePath));
|
||||||
|
|
||||||
|
return File (juceString (localEnv, jPath.get()));
|
||||||
|
}();
|
||||||
|
|
||||||
|
mapEntry = cacheDirectory.getChildFile ("bindata_" + key);
|
||||||
|
mapEntry.replaceWithData (data.data(), data.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
static TypefaceAscentDescent findNonPortableMetricsForFile (File file)
|
||||||
|
{
|
||||||
|
auto* env = getEnv();
|
||||||
|
const LocalRef typeface { env->CallStaticObjectMethod (TypefaceClass,
|
||||||
|
TypefaceClass.createFromFile,
|
||||||
|
javaString (file.getFullPathName()).get()) };
|
||||||
|
return findNonPortableMetricsForTypeface (typeface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TypefaceAscentDescent findNonPortableMetricsForData (Span<const std::byte> bytes)
|
||||||
|
{
|
||||||
|
const auto file = getCacheFileForData (bytes);
|
||||||
|
return findNonPortableMetricsForFile (file);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TypefaceAscentDescent findNonPortableMetricsForAsset (const String& name)
|
||||||
|
{
|
||||||
|
auto* env = getEnv();
|
||||||
|
|
||||||
|
const LocalRef assetManager { env->CallObjectMethod (getAppContext().get(), AndroidContext.getAssets) };
|
||||||
|
const LocalRef typeface { env->CallStaticObjectMethod (TypefaceClass,
|
||||||
|
TypefaceClass.createFromAsset,
|
||||||
|
assetManager.get(),
|
||||||
|
javaString ("fonts/" + name).get()) };
|
||||||
|
return findNonPortableMetricsForTypeface (typeface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TypefaceAscentDescent findNonPortableMetricsForTypeface (const LocalRef<jobject>& typeface)
|
||||||
|
{
|
||||||
|
constexpr auto referenceFontSize = 256.0f;
|
||||||
|
|
||||||
|
auto* env = getEnv();
|
||||||
|
|
||||||
|
jint constructorFlags = 1 /*ANTI_ALIAS_FLAG*/
|
||||||
|
| 2 /*FILTER_BITMAP_FLAG*/
|
||||||
|
| 4 /*DITHER_FLAG*/
|
||||||
|
| 128 /*SUBPIXEL_TEXT_FLAG*/;
|
||||||
|
|
||||||
|
const LocalRef paint { env->NewObject (AndroidPaint, AndroidPaint.constructor, constructorFlags) };
|
||||||
|
|
||||||
|
env->CallObjectMethod (paint, AndroidPaint.setTypeface, typeface.get());
|
||||||
|
env->CallVoidMethod (paint, AndroidPaint.setTextSize, referenceFontSize);
|
||||||
|
|
||||||
|
const auto fullAscent = std::abs (env->CallFloatMethod (paint, AndroidPaint.ascent));
|
||||||
|
const auto fullDescent = std::abs (env->CallFloatMethod (paint, AndroidPaint.descent));
|
||||||
|
|
||||||
|
return TypefaceAscentDescent { fullAscent / referenceFontSize,
|
||||||
|
fullDescent / referenceFontSize };
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<hb_font_t> hbFont;
|
std::shared_ptr<hb_font_t> hbFont;
|
||||||
DoCache doCache;
|
DoCache doCache;
|
||||||
|
TypefaceAscentDescent nonPortableMetrics;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@ public:
|
||||||
|
|
||||||
Native getNativeDetails() const override
|
Native getNativeDetails() const override
|
||||||
{
|
{
|
||||||
return Native { hb.get() };
|
return Native { hb.get(), nonPortableMetrics };
|
||||||
}
|
}
|
||||||
|
|
||||||
Typeface::Ptr createSystemFallback ([[maybe_unused]] const String& text,
|
Typeface::Ptr createSystemFallback ([[maybe_unused]] const String& text,
|
||||||
|
|
@ -535,6 +535,8 @@ private:
|
||||||
FTFaceWrapper::Ptr ftFace;
|
FTFaceWrapper::Ptr ftFace;
|
||||||
HbFont hb;
|
HbFont hb;
|
||||||
DoCache doCache;
|
DoCache doCache;
|
||||||
|
TypefaceAscentDescent nonPortableMetrics { (float) std::abs (ftFace->face->ascender) / (float) ftFace->face->units_per_EM,
|
||||||
|
(float) std::abs (ftFace->face->descender) / (float) ftFace->face->units_per_EM };
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE (FreeTypeTypeface)
|
JUCE_DECLARE_NON_COPYABLE (FreeTypeTypeface)
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -406,9 +406,9 @@ namespace CoreTextTypeLayout
|
||||||
CFUniquePtr<CFStringRef> cfsFontFamily ((CFStringRef) CTFontCopyAttribute (ctRunFont, kCTFontFamilyNameAttribute));
|
CFUniquePtr<CFStringRef> cfsFontFamily ((CFStringRef) CTFontCopyAttribute (ctRunFont, kCTFontFamilyNameAttribute));
|
||||||
CFUniquePtr<CFStringRef> cfsFontStyle ((CFStringRef) CTFontCopyAttribute (ctRunFont, kCTFontStyleNameAttribute));
|
CFUniquePtr<CFStringRef> cfsFontStyle ((CFStringRef) CTFontCopyAttribute (ctRunFont, kCTFontStyleNameAttribute));
|
||||||
|
|
||||||
Font result (String::fromCFString (cfsFontFamily.get()),
|
Font result (FontOptions { String::fromCFString (cfsFontFamily.get()),
|
||||||
String::fromCFString (cfsFontStyle.get()),
|
String::fromCFString (cfsFontStyle.get()),
|
||||||
(float) (CTFontGetSize (ctRunFont) / fontHeightToPointsFactor));
|
(float) (CTFontGetSize (ctRunFont) / fontHeightToPointsFactor) });
|
||||||
|
|
||||||
auto isUnderlined = [&]
|
auto isUnderlined = [&]
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2498,7 +2498,7 @@ public:
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Image image;
|
Image image;
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SoftwareRendererSavedState& operator= (const SoftwareRendererSavedState&) = delete;
|
SoftwareRendererSavedState& operator= (const SoftwareRendererSavedState&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ HyperlinkButton::HyperlinkButton (const String& linkText,
|
||||||
const URL& linkURL)
|
const URL& linkURL)
|
||||||
: Button (linkText),
|
: Button (linkText),
|
||||||
url (linkURL),
|
url (linkURL),
|
||||||
font (14.0f, Font::underlined),
|
font (FontOptions { 14.0f, Font::underlined }),
|
||||||
resizeFont (true),
|
resizeFont (true),
|
||||||
justification (Justification::centred)
|
justification (Justification::centred)
|
||||||
{
|
{
|
||||||
|
|
@ -49,7 +49,7 @@ HyperlinkButton::HyperlinkButton (const String& linkText,
|
||||||
|
|
||||||
HyperlinkButton::HyperlinkButton()
|
HyperlinkButton::HyperlinkButton()
|
||||||
: Button (String()),
|
: Button (String()),
|
||||||
font (14.0f, Font::underlined),
|
font (FontOptions { 14.0f, Font::underlined }),
|
||||||
resizeFont (true),
|
resizeFont (true),
|
||||||
justification (Justification::centred)
|
justification (Justification::centred)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ struct LookAndFeelHelpers
|
||||||
|
|
||||||
AttributedString s;
|
AttributedString s;
|
||||||
s.setJustification (Justification::centred);
|
s.setJustification (Justification::centred);
|
||||||
s.append (text, Font (tooltipFontSize, Font::bold), colour);
|
s.append (text, FontOptions (tooltipFontSize, Font::bold), colour);
|
||||||
|
|
||||||
TextLayout tl;
|
TextLayout tl;
|
||||||
tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
|
tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ DrawableText::DrawableText()
|
||||||
justification (Justification::centredLeft)
|
justification (Justification::centredLeft)
|
||||||
{
|
{
|
||||||
setBoundingBox (Parallelogram<float> ({ 0.0f, 0.0f, 50.0f, 20.0f }));
|
setBoundingBox (Parallelogram<float> ({ 0.0f, 0.0f, 50.0f, 20.0f }));
|
||||||
setFont (Font (15.0f), true);
|
setFont (FontOptions (15.0f), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawableText::DrawableText (const DrawableText& other)
|
DrawableText::DrawableText (const DrawableText& other)
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Parallelogram<float> bounds;
|
Parallelogram<float> bounds;
|
||||||
float fontHeight, fontHScale;
|
float fontHeight, fontHScale;
|
||||||
Font font, scaledFont;
|
Font font { FontOptions{} }, scaledFont { FontOptions{} };
|
||||||
String text;
|
String text;
|
||||||
Colour colour;
|
Colour colour;
|
||||||
Justification justification;
|
Justification justification;
|
||||||
|
|
|
||||||
|
|
@ -1225,7 +1225,7 @@ private:
|
||||||
|
|
||||||
Font getFont (const XmlPath& xml) const
|
Font getFont (const XmlPath& xml) const
|
||||||
{
|
{
|
||||||
Font f;
|
Font f { FontOptions{} };
|
||||||
auto family = getStyleAttribute (xml, "font-family").unquoted();
|
auto family = getStyleAttribute (xml, "font-family").unquoted();
|
||||||
|
|
||||||
if (family.isNotEmpty())
|
if (family.isNotEmpty())
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void FileSearchPathListComponent::paintListBoxItem (int rowNumber, Graphics& g,
|
||||||
g.fillAll (findColour (TextEditor::highlightColourId));
|
g.fillAll (findColour (TextEditor::highlightColourId));
|
||||||
|
|
||||||
g.setColour (findColour (ListBox::textColourId));
|
g.setColour (findColour (ListBox::textColourId));
|
||||||
Font f ((float) height * 0.7f);
|
Font f (FontOptions { (float) height * 0.7f });
|
||||||
f.setHorizontalScale (0.9f);
|
f.setHorizontalScale (0.9f);
|
||||||
g.setFont (f);
|
g.setFont (f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ void LookAndFeel_V1::drawComboBox (Graphics& g, int width, int height,
|
||||||
|
|
||||||
Font LookAndFeel_V1::getComboBoxFont (ComboBox& box)
|
Font LookAndFeel_V1::getComboBoxFont (ComboBox& box)
|
||||||
{
|
{
|
||||||
Font f (jmin (15.0f, (float) box.getHeight() * 0.85f));
|
Font f (FontOptions { jmin (15.0f, (float) box.getHeight() * 0.85f) });
|
||||||
f.setHorizontalScale (0.9f);
|
f.setHorizontalScale (0.9f);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ void LookAndFeel_V2::drawButtonBackground (Graphics& g,
|
||||||
|
|
||||||
Font LookAndFeel_V2::getTextButtonFont (TextButton&, int buttonHeight)
|
Font LookAndFeel_V2::getTextButtonFont (TextButton&, int buttonHeight)
|
||||||
{
|
{
|
||||||
return Font (jmin (15.0f, (float) buttonHeight * 0.6f));
|
return FontOptions (jmin (15.0f, (float) buttonHeight * 0.6f));
|
||||||
}
|
}
|
||||||
|
|
||||||
int LookAndFeel_V2::getTextButtonWidthToFitText (TextButton& b, int buttonHeight)
|
int LookAndFeel_V2::getTextButtonWidthToFitText (TextButton& b, int buttonHeight)
|
||||||
|
|
@ -359,7 +359,7 @@ void LookAndFeel_V2::changeToggleButtonWidthToFitText (ToggleButton& button)
|
||||||
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
|
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
|
||||||
auto tickWidth = fontSize * 1.1f;
|
auto tickWidth = fontSize * 1.1f;
|
||||||
|
|
||||||
Font font (fontSize);
|
Font font (FontOptions { fontSize });
|
||||||
|
|
||||||
button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 9,
|
button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 9,
|
||||||
button.getHeight());
|
button.getHeight());
|
||||||
|
|
@ -471,7 +471,7 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert,
|
||||||
}
|
}
|
||||||
|
|
||||||
GlyphArrangement ga;
|
GlyphArrangement ga;
|
||||||
ga.addFittedText (Font ((float) iconRect.getHeight() * 0.9f, Font::bold),
|
ga.addFittedText (FontOptions ((float) iconRect.getHeight() * 0.9f, Font::bold),
|
||||||
String::charToString ((juce_wchar) (uint8) character),
|
String::charToString ((juce_wchar) (uint8) character),
|
||||||
(float) iconRect.getX(), (float) iconRect.getY(),
|
(float) iconRect.getX(), (float) iconRect.getY(),
|
||||||
(float) iconRect.getWidth(), (float) iconRect.getHeight(),
|
(float) iconRect.getWidth(), (float) iconRect.getHeight(),
|
||||||
|
|
@ -528,12 +528,12 @@ Font LookAndFeel_V2::getAlertWindowTitleFont()
|
||||||
|
|
||||||
Font LookAndFeel_V2::getAlertWindowMessageFont()
|
Font LookAndFeel_V2::getAlertWindowMessageFont()
|
||||||
{
|
{
|
||||||
return Font (15.0f);
|
return FontOptions (15.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Font LookAndFeel_V2::getAlertWindowFont()
|
Font LookAndFeel_V2::getAlertWindowFont()
|
||||||
{
|
{
|
||||||
return Font (12.0f);
|
return FontOptions (12.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -864,7 +864,7 @@ void LookAndFeel_V2::setComponentEffectForBubbleComponent (BubbleComponent& bubb
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Font LookAndFeel_V2::getPopupMenuFont()
|
Font LookAndFeel_V2::getPopupMenuFont()
|
||||||
{
|
{
|
||||||
return Font (17.0f);
|
return FontOptions (17.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LookAndFeel_V2::getIdealPopupMenuItemSize (const String& text, const bool isSeparator,
|
void LookAndFeel_V2::getIdealPopupMenuItemSize (const String& text, const bool isSeparator,
|
||||||
|
|
@ -1112,7 +1112,7 @@ void LookAndFeel_V2::drawMenuBarBackground (Graphics& g, int width, int height,
|
||||||
|
|
||||||
Font LookAndFeel_V2::getMenuBarFont (MenuBarComponent& menuBar, int /*itemIndex*/, const String& /*itemText*/)
|
Font LookAndFeel_V2::getMenuBarFont (MenuBarComponent& menuBar, int /*itemIndex*/, const String& /*itemText*/)
|
||||||
{
|
{
|
||||||
return Font ((float) menuBar.getHeight() * 0.7f);
|
return FontOptions ((float) menuBar.getHeight() * 0.7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LookAndFeel_V2::getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText)
|
int LookAndFeel_V2::getMenuBarItemWidth (MenuBarComponent& menuBar, int itemIndex, const String& itemText)
|
||||||
|
|
@ -1264,7 +1264,7 @@ void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const boo
|
||||||
|
|
||||||
Font LookAndFeel_V2::getComboBoxFont (ComboBox& box)
|
Font LookAndFeel_V2::getComboBoxFont (ComboBox& box)
|
||||||
{
|
{
|
||||||
return Font (jmin (15.0f, (float) box.getHeight() * 0.85f));
|
return FontOptions (jmin (15.0f, (float) box.getHeight() * 0.85f));
|
||||||
}
|
}
|
||||||
|
|
||||||
Label* LookAndFeel_V2::createComboBoxTextBox (ComboBox&)
|
Label* LookAndFeel_V2::createComboBoxTextBox (ComboBox&)
|
||||||
|
|
@ -1645,7 +1645,7 @@ ImageEffectFilter* LookAndFeel_V2::getSliderEffect (Slider&)
|
||||||
|
|
||||||
Font LookAndFeel_V2::getSliderPopupFont (Slider&)
|
Font LookAndFeel_V2::getSliderPopupFont (Slider&)
|
||||||
{
|
{
|
||||||
return Font (15.0f, Font::bold);
|
return FontOptions (15.0f, Font::bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LookAndFeel_V2::getSliderPopupPlacement (Slider&)
|
int LookAndFeel_V2::getSliderPopupPlacement (Slider&)
|
||||||
|
|
@ -1784,7 +1784,7 @@ void LookAndFeel_V2::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int
|
||||||
g.drawRect (area);
|
g.drawRect (area);
|
||||||
|
|
||||||
g.setColour (Colours::white);
|
g.setColour (Colours::white);
|
||||||
g.setFont (Font ((float) area.getHeight() * 0.7f).boldened());
|
g.setFont (Font (FontOptions { (float) area.getHeight() * 0.7f }).boldened());
|
||||||
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
|
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1884,7 +1884,7 @@ void LookAndFeel_V2::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic
|
||||||
window.getBackgroundColour().contrasting (isActive ? 0.15f : 0.05f), (float) h));
|
window.getBackgroundColour().contrasting (isActive ? 0.15f : 0.05f), (float) h));
|
||||||
g.fillAll();
|
g.fillAll();
|
||||||
|
|
||||||
Font font ((float) h * 0.65f, Font::bold);
|
Font font (FontOptions { (float) h * 0.65f, Font::bold });
|
||||||
g.setFont (font);
|
g.setFont (font);
|
||||||
|
|
||||||
int textW = font.getStringWidth (window.getName());
|
int textW = font.getStringWidth (window.getName());
|
||||||
|
|
@ -2124,7 +2124,7 @@ void LookAndFeel_V2::drawGroupComponentOutline (Graphics& g, int width, int heig
|
||||||
const float textEdgeGap = 4.0f;
|
const float textEdgeGap = 4.0f;
|
||||||
auto cs = 5.0f;
|
auto cs = 5.0f;
|
||||||
|
|
||||||
Font f (textH);
|
Font f (FontOptions { textH });
|
||||||
|
|
||||||
Path p;
|
Path p;
|
||||||
auto x = indent;
|
auto x = indent;
|
||||||
|
|
@ -2190,7 +2190,7 @@ int LookAndFeel_V2::getTabButtonSpaceAroundImage()
|
||||||
|
|
||||||
int LookAndFeel_V2::getTabButtonBestWidth (TabBarButton& button, int tabDepth)
|
int LookAndFeel_V2::getTabButtonBestWidth (TabBarButton& button, int tabDepth)
|
||||||
{
|
{
|
||||||
int width = Font ((float) tabDepth * 0.6f).getStringWidth (button.getButtonText().trim())
|
int width = Font (FontOptions { (float) tabDepth * 0.6f }).getStringWidth (button.getButtonText().trim())
|
||||||
+ getTabButtonOverlap (tabDepth) * 2;
|
+ getTabButtonOverlap (tabDepth) * 2;
|
||||||
|
|
||||||
if (auto* extraComponent = button.getExtraComponent())
|
if (auto* extraComponent = button.getExtraComponent())
|
||||||
|
|
@ -2312,7 +2312,7 @@ void LookAndFeel_V2::fillTabButtonShape (TabBarButton& button, Graphics& g, cons
|
||||||
|
|
||||||
Font LookAndFeel_V2::getTabButtonFont (TabBarButton&, float height)
|
Font LookAndFeel_V2::getTabButtonFont (TabBarButton&, float height)
|
||||||
{
|
{
|
||||||
return { height * 0.6f };
|
return FontOptions { height * 0.6f };
|
||||||
}
|
}
|
||||||
|
|
||||||
void LookAndFeel_V2::drawTabButtonText (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
|
void LookAndFeel_V2::drawTabButtonText (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
|
||||||
|
|
@ -2515,7 +2515,7 @@ void LookAndFeel_V2::drawTableHeaderColumn (Graphics& g, TableHeaderComponent& h
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setColour (header.findColour (TableHeaderComponent::textColourId));
|
g.setColour (header.findColour (TableHeaderComponent::textColourId));
|
||||||
g.setFont (Font ((float) height * 0.5f, Font::bold));
|
g.setFont (FontOptions ((float) height * 0.5f, Font::bold));
|
||||||
g.drawFittedText (columnName, area, Justification::centredLeft, 1);
|
g.drawFittedText (columnName, area, Justification::centredLeft, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2585,7 +2585,7 @@ void LookAndFeel_V2::drawPropertyPanelSectionHeader (Graphics& g, const String&
|
||||||
auto textX = (int) (buttonIndent * 2.0f + buttonSize + 2.0f);
|
auto textX = (int) (buttonIndent * 2.0f + buttonSize + 2.0f);
|
||||||
|
|
||||||
g.setColour (Colours::black);
|
g.setColour (Colours::black);
|
||||||
g.setFont (Font ((float) height * 0.7f, Font::bold));
|
g.setFont (FontOptions ((float) height * 0.7f, Font::bold));
|
||||||
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
|
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2660,8 +2660,8 @@ AttributedString LookAndFeel_V2::createFileChooserHeaderText (const String& titl
|
||||||
s.setJustification (Justification::centred);
|
s.setJustification (Justification::centred);
|
||||||
|
|
||||||
auto colour = findColour (FileChooserDialogBox::titleTextColourId);
|
auto colour = findColour (FileChooserDialogBox::titleTextColourId);
|
||||||
s.append (title + "\n\n", Font (17.0f, Font::bold), colour);
|
s.append (title + "\n\n", FontOptions (17.0f, Font::bold), colour);
|
||||||
s.append (instructions, Font (14.0f), colour);
|
s.append (instructions, FontOptions (14.0f), colour);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
@ -2950,7 +2950,7 @@ void LookAndFeel_V2::drawKeymapChangeButton (Graphics& g, int width, int height,
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Font LookAndFeel_V2::getSidePanelTitleFont (SidePanel&)
|
Font LookAndFeel_V2::getSidePanelTitleFont (SidePanel&)
|
||||||
{
|
{
|
||||||
return Font (18.0f);
|
return FontOptions (18.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Justification LookAndFeel_V2::getSidePanelTitleJustification (SidePanel& panel)
|
Justification LookAndFeel_V2::getSidePanelTitleJustification (SidePanel& panel)
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ void LookAndFeel_V3::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int
|
||||||
g.fillRect (area.withTop (area.getBottom() - 1));
|
g.fillRect (area.withTop (area.getBottom() - 1));
|
||||||
|
|
||||||
g.setColour (bkg.contrasting());
|
g.setColour (bkg.contrasting());
|
||||||
g.setFont (Font ((float) area.getHeight() * 0.6f).boldened());
|
g.setFont (Font (FontOptions { (float) area.getHeight() * 0.6f }).boldened());
|
||||||
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
|
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ int LookAndFeel_V3::getTabButtonSpaceAroundImage() { return 0
|
||||||
void LookAndFeel_V3::createTabTextLayout (const TabBarButton& button, float length, float depth,
|
void LookAndFeel_V3::createTabTextLayout (const TabBarButton& button, float length, float depth,
|
||||||
Colour colour, TextLayout& textLayout)
|
Colour colour, TextLayout& textLayout)
|
||||||
{
|
{
|
||||||
Font font (depth * 0.5f);
|
Font font (FontOptions { depth * 0.5f });
|
||||||
font.setUnderline (button.hasKeyboardFocus (false));
|
font.setUnderline (button.hasKeyboardFocus (false));
|
||||||
|
|
||||||
AttributedString s;
|
AttributedString s;
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic
|
||||||
g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::widgetBackground));
|
g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::widgetBackground));
|
||||||
g.fillAll();
|
g.fillAll();
|
||||||
|
|
||||||
Font font ((float) h * 0.65f, Font::plain);
|
Font font (FontOptions { (float) h * 0.65f, Font::plain });
|
||||||
g.setFont (font);
|
g.setFont (font);
|
||||||
|
|
||||||
auto textW = font.getStringWidth (window.getName());
|
auto textW = font.getStringWidth (window.getName());
|
||||||
|
|
@ -284,7 +284,7 @@ void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight)
|
Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight)
|
||||||
{
|
{
|
||||||
return { jmin (16.0f, (float) buttonHeight * 0.6f) };
|
return FontOptions { jmin (16.0f, (float) buttonHeight * 0.6f) };
|
||||||
}
|
}
|
||||||
|
|
||||||
void LookAndFeel_V4::drawButtonBackground (Graphics& g,
|
void LookAndFeel_V4::drawButtonBackground (Graphics& g,
|
||||||
|
|
@ -384,7 +384,7 @@ void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button)
|
||||||
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
|
auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
|
||||||
auto tickWidth = fontSize * 1.1f;
|
auto tickWidth = fontSize * 1.1f;
|
||||||
|
|
||||||
Font font (fontSize);
|
Font font (FontOptions { fontSize });
|
||||||
|
|
||||||
button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 14, button.getHeight());
|
button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 14, button.getHeight());
|
||||||
}
|
}
|
||||||
|
|
@ -462,7 +462,7 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
|
||||||
}
|
}
|
||||||
|
|
||||||
GlyphArrangement ga;
|
GlyphArrangement ga;
|
||||||
ga.addFittedText ({ (float) iconRect.getHeight() * 0.9f, Font::bold },
|
ga.addFittedText (FontOptions { (float) iconRect.getHeight() * 0.9f, Font::bold },
|
||||||
String::charToString ((juce_wchar) (uint8) character),
|
String::charToString ((juce_wchar) (uint8) character),
|
||||||
static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getY()),
|
static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getY()),
|
||||||
static_cast<float> (iconRect.getWidth()), static_cast<float> (iconRect.getHeight()),
|
static_cast<float> (iconRect.getWidth()), static_cast<float> (iconRect.getHeight()),
|
||||||
|
|
@ -485,9 +485,9 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
|
||||||
}
|
}
|
||||||
|
|
||||||
int LookAndFeel_V4::getAlertWindowButtonHeight() { return 40; }
|
int LookAndFeel_V4::getAlertWindowButtonHeight() { return 40; }
|
||||||
Font LookAndFeel_V4::getAlertWindowTitleFont() { return { 18.0f, Font::bold }; }
|
Font LookAndFeel_V4::getAlertWindowTitleFont() { return FontOptions { 18.0f, Font::bold }; }
|
||||||
Font LookAndFeel_V4::getAlertWindowMessageFont() { return { 16.0f }; }
|
Font LookAndFeel_V4::getAlertWindowMessageFont() { return FontOptions { 16.0f }; }
|
||||||
Font LookAndFeel_V4::getAlertWindowFont() { return { 14.0f }; }
|
Font LookAndFeel_V4::getAlertWindowFont() { return FontOptions { 14.0f }; }
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void LookAndFeel_V4::drawProgressBar (Graphics& g, ProgressBar& progressBar,
|
void LookAndFeel_V4::drawProgressBar (Graphics& g, ProgressBar& progressBar,
|
||||||
|
|
@ -629,7 +629,7 @@ void LookAndFeel_V4::drawCircularProgressBar (Graphics& g, const ProgressBar& pr
|
||||||
if (textToShow.isNotEmpty())
|
if (textToShow.isNotEmpty())
|
||||||
{
|
{
|
||||||
g.setColour (progressBar.findColour (TextButton::textColourOffId));
|
g.setColour (progressBar.findColour (TextButton::textColourOffId));
|
||||||
g.setFont ({ 12.0f, Font::italic });
|
g.setFont (FontOptions { 12.0f, Font::italic });
|
||||||
g.drawText (textToShow, barBounds, Justification::centred, false);
|
g.drawText (textToShow, barBounds, Justification::centred, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -950,7 +950,7 @@ void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool,
|
||||||
|
|
||||||
Font LookAndFeel_V4::getComboBoxFont (ComboBox& box)
|
Font LookAndFeel_V4::getComboBoxFont (ComboBox& box)
|
||||||
{
|
{
|
||||||
return { jmin (16.0f, (float) box.getHeight() * 0.85f) };
|
return FontOptions { jmin (16.0f, (float) box.getHeight() * 0.85f) };
|
||||||
}
|
}
|
||||||
|
|
||||||
void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label)
|
void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label)
|
||||||
|
|
@ -1268,7 +1268,7 @@ void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String&
|
||||||
|
|
||||||
g.setColour (findColour (PropertyComponent::labelTextColourId));
|
g.setColour (findColour (PropertyComponent::labelTextColourId));
|
||||||
|
|
||||||
g.setFont ({ (float) height * 0.7f, Font::bold });
|
g.setFont (FontOptions { (float) height * 0.7f, Font::bold });
|
||||||
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
|
g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Value textValue;
|
Value textValue;
|
||||||
String lastTextValue;
|
String lastTextValue;
|
||||||
Font font { 15.0f };
|
Font font { FontOptions { 15.0f } };
|
||||||
Justification justification = Justification::centredLeft;
|
Justification justification = Justification::centredLeft;
|
||||||
std::unique_ptr<TextEditor> editor;
|
std::unique_ptr<TextEditor> editor;
|
||||||
ListenerList<Listener> listeners;
|
ListenerList<Listener> listeners;
|
||||||
|
|
|
||||||
|
|
@ -825,7 +825,7 @@ private:
|
||||||
Range<int> selection;
|
Range<int> selection;
|
||||||
int leftIndent = 4, topIndent = 4;
|
int leftIndent = 4, topIndent = 4;
|
||||||
unsigned int lastTransactionTime = 0;
|
unsigned int lastTransactionTime = 0;
|
||||||
Font currentFont { 14.0f };
|
Font currentFont { FontOptions { 14.0f } };
|
||||||
mutable int totalNumChars = 0;
|
mutable int totalNumChars = 0;
|
||||||
int caretPosition = 0;
|
int caretPosition = 0;
|
||||||
OwnedArray<UniformTextSection> sections;
|
OwnedArray<UniformTextSection> sections;
|
||||||
|
|
|
||||||
|
|
@ -770,7 +770,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
addAndMakeVisible (instructions);
|
addAndMakeVisible (instructions);
|
||||||
instructions.setFont (Font (13.0f));
|
instructions.setFont (FontOptions (13.0f));
|
||||||
|
|
||||||
setSize (500, 300);
|
setSize (500, 300);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ CodeEditorComponent::CodeEditorComponent (CodeDocument& doc, CodeTokeniser* cons
|
||||||
addAndMakeVisible (horizontalScrollBar);
|
addAndMakeVisible (horizontalScrollBar);
|
||||||
horizontalScrollBar.setSingleStepSize (1.0);
|
horizontalScrollBar.setSingleStepSize (1.0);
|
||||||
|
|
||||||
Font f (12.0f);
|
Font f (FontOptions { 12.0f });
|
||||||
f.setTypefaceName (Font::getDefaultMonospacedFontName());
|
f.setTypefaceName (Font::getDefaultMonospacedFontName());
|
||||||
setFont (f);
|
setFont (f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,7 @@ private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
CodeDocument& document;
|
CodeDocument& document;
|
||||||
|
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
int firstLineOnScreen = 0, spacesPerTab = 4;
|
int firstLineOnScreen = 0, spacesPerTab = 4;
|
||||||
float charWidth = 0;
|
float charWidth = 0;
|
||||||
int lineHeight = 0, linesOnScreen = 0, columnsOnScreen = 0;
|
int lineHeight = 0, linesOnScreen = 0, columnsOnScreen = 0;
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ private:
|
||||||
ColourSelector& owner;
|
ColourSelector& owner;
|
||||||
|
|
||||||
Colour currentColour;
|
Colour currentColour;
|
||||||
Font labelFont { 14.0f, Font::bold };
|
Font labelFont { FontOptions { 14.0f, Font::bold } };
|
||||||
int labelWidth = 0;
|
int labelWidth = 0;
|
||||||
Label colourLabel;
|
Label colourLabel;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public:
|
||||||
if (keyNum < 0)
|
if (keyNum < 0)
|
||||||
setSize (h, h);
|
setSize (h, h);
|
||||||
else
|
else
|
||||||
setSize (jlimit (h * 4, h * 8, 6 + Font ((float) h * 0.6f).getStringWidth (getName())), h);
|
setSize (jlimit (h * 4, h * 8, 6 + Font (FontOptions { (float) h * 0.6f }).getStringWidth (getName())), h);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -321,7 +321,7 @@ public:
|
||||||
|
|
||||||
void paintItem (Graphics& g, int width, int height) override
|
void paintItem (Graphics& g, int width, int height) override
|
||||||
{
|
{
|
||||||
g.setFont (Font ((float) height * 0.7f, Font::bold));
|
g.setFont (FontOptions ((float) height * 0.7f, Font::bold));
|
||||||
g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId));
|
g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId));
|
||||||
|
|
||||||
g.drawText (TRANS (categoryName), 2, 0, width - 2, height, Justification::centredLeft, true);
|
g.drawText (TRANS (categoryName), 2, 0, width - 2, height, Justification::centredLeft, true);
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ LivePropertyEditorBase::LivePropertyEditorBase (LiveValueBase& v, CodeDocument&
|
||||||
findOriginalValueInCode();
|
findOriginalValueInCode();
|
||||||
selectOriginalValue();
|
selectOriginalValue();
|
||||||
|
|
||||||
name.setFont (13.0f);
|
name.setFont (FontOptions { 13.0f });
|
||||||
name.setText (v.name, dontSendNotification);
|
name.setText (v.name, dontSendNotification);
|
||||||
valueEditor.setMultiLine (v.isString());
|
valueEditor.setMultiLine (v.isString());
|
||||||
valueEditor.setReturnKeyStartsNewLine (v.isString());
|
valueEditor.setReturnKeyStartsNewLine (v.isString());
|
||||||
|
|
|
||||||
|
|
@ -1814,7 +1814,7 @@ struct SavedState final : public RenderingHelpers::SavedStateBase<SavedState>
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
Font font;
|
Font font { FontOptions{} };
|
||||||
GLState* state;
|
GLState* state;
|
||||||
bool isUsingCustomShader = false;
|
bool isUsingCustomShader = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,9 +250,9 @@ void OnlineUnlockForm::resized()
|
||||||
r.removeFromBottom (20);
|
r.removeFromBottom (20);
|
||||||
|
|
||||||
// (force use of a default system font to make sure it has the password blob character)
|
// (force use of a default system font to make sure it has the password blob character)
|
||||||
Font font (Font::getDefaultTypefaceForFont (Font (Font::getDefaultSansSerifFontName(),
|
Font font (FontOptions { Font::getDefaultTypefaceForFont (FontOptions (Font::getDefaultSansSerifFontName(),
|
||||||
Font::getDefaultStyle(),
|
Font::getDefaultStyle(),
|
||||||
5.0f)));
|
5.0f)) });
|
||||||
|
|
||||||
const int boxHeight = 24;
|
const int boxHeight = 24;
|
||||||
passwordBox.setBounds (r.removeFromBottom (boxHeight));
|
passwordBox.setBounds (r.removeFromBottom (boxHeight));
|
||||||
|
|
@ -286,7 +286,7 @@ void OnlineUnlockForm::showBubbleMessage (const String& text, Component& target)
|
||||||
addChildComponent (bubble.get());
|
addChildComponent (bubble.get());
|
||||||
|
|
||||||
AttributedString attString;
|
AttributedString attString;
|
||||||
attString.append (text, Font (16.0f));
|
attString.append (text, FontOptions (16.0f));
|
||||||
|
|
||||||
bubble->showAt (getLocalArea (&target, target.getLocalBounds()),
|
bubble->showAt (getLocalArea (&target, target.getLocalBounds()),
|
||||||
attString, 500, // numMillisecondsBeforeRemoving
|
attString, 500, // numMillisecondsBeforeRemoving
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue