Skip to content

Commit 6586cd5

Browse files
committed
Replaced deprecated calls to Font::getStringWidth
1 parent 6ff8f36 commit 6586cd5

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Source/Components/EarlySection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ void EarlySection::resized()
4747
const int elementHeight = (area.getHeight() - 5) / 3; // remove 5 pixels from the bottom
4848

4949
auto sectionTitleAndInfo = area.removeFromTop(elementHeight);
50-
// for some reason the string width calculation is not reliable... therefore + 10
51-
const int sectionTitleTextWidth = mSectionTitle.getFont().getStringWidth(mSectionTitle.getText()) + 10;
50+
// add 12 to increase the size a bit
51+
const int sectionTitleTextWidth = static_cast<int>(juce::TextLayout::getStringWidth(mSectionTitle.getFont(), mSectionTitle.getText())) + 12;
5252
mSectionTitle.setBounds(sectionTitleAndInfo.removeFromLeft(sectionTitleTextWidth));
5353
mSectionInfoButton.setBounds(sectionTitleAndInfo.getX(), sectionTitleAndInfo.getCentreY() - 12, 24, 24);
5454

Source/Components/LateSection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void LateSection::resized()
6262
const int elementHeight = (area.getHeight() - 5) / 9; // remove 5 pixels from the bottom
6363

6464
auto sectionTitleAndInfo = area.removeFromTop(elementHeight);
65-
// for some reason the string width calculation is not reliable... therefore + 10
66-
const int sectionTitleTextWidth = mSectionTitle.getFont().getStringWidth(mSectionTitle.getText()) + 10;
65+
// add 12 to increase the size a bit
66+
const int sectionTitleTextWidth = static_cast<int>(juce::TextLayout::getStringWidth(mSectionTitle.getFont(), mSectionTitle.getText())) + 12;
6767
mSectionTitle.setBounds(sectionTitleAndInfo.removeFromLeft(sectionTitleTextWidth));
6868
mSectionInfoButton.setBounds(sectionTitleAndInfo.getX(), sectionTitleAndInfo.getCentreY() - 12, 24, 24);
6969

Source/Components/OutputSection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ void OutputSection::resized()
5656
const int elementHeight = (area.getHeight() - 5) / 6; // remove 5 pixels from the bottom
5757

5858
auto sectionTitleAndInfo = area.removeFromTop(elementHeight);
59-
// for some reason the string width calculation is not reliable... therefore + 10
60-
const int sectionTitleTextWidth = mSectionTitle.getFont().getStringWidth(mSectionTitle.getText()) + 10;
59+
// add 12 to increase the size a bit
60+
const int sectionTitleTextWidth = static_cast<int>(juce::TextLayout::getStringWidth(mSectionTitle.getFont(), mSectionTitle.getText())) + 12;
6161
mSectionTitle.setBounds(sectionTitleAndInfo.removeFromLeft(sectionTitleTextWidth));
6262
mSectionInfoButton.setBounds(sectionTitleAndInfo.getX(), sectionTitleAndInfo.getCentreY() - 12, 24, 24);
6363

Source/Components/SliderComponent.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ void SliderComponent::resized()
6969
mParameterIcon->setBounds(parameterIconArea);
7070

7171
auto labelAndInfo = area.removeFromTop(area.getHeight() / 2);
72-
// for some reason the string width calculation is not reliable... therefore + 10
73-
const int labelTextWidth = mParameterLabel.getFont().getStringWidth(mParameterLabel.getText()) + 10;
72+
// add 12 to increase the size a bit
73+
const int labelTextWidth = static_cast<int>(juce::TextLayout::getStringWidth(mParameterLabel.getFont(), mParameterLabel.getText())) + 12;
7474
mParameterLabel.setBounds(labelAndInfo.removeFromLeft(labelTextWidth));
7575
mParameterInfoButton.setBounds(labelAndInfo.getX(), labelAndInfo.getCentreY() - 12, 24, 24);
7676

0 commit comments

Comments
 (0)