Skip to content

Commit

Permalink
Update for Font::getStringWidth deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
FigBug committed Sep 18, 2024
1 parent ac5595d commit 4293b71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions melatonin/components/overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ namespace melatonin

void drawDimensionsLabel()
{
int labelWidth = (int) dimensions.getFont().getStringWidthFloat (dimensionsString (selectedBounds)) + 15;
int labelWidth = (int) juce::GlyphArrangement::getStringWidth ( dimensions.getFont(), dimensionsString (selectedBounds)) + 15;
int labelHeight = 15;
auto paddingToLabel = 4;
auto labelCenterX = selectedBounds.getX() + selectedBounds.getWidth() / 2;
Expand Down Expand Up @@ -413,7 +413,7 @@ namespace melatonin
// top
if (lineToTopHoveredComponent.getLength() > 0)
{
int labelWidth = (int) distanceToTopHoveredLabel.getFont().getStringWidthFloat (distanceString (lineToTopHoveredComponent)) + 15;
int labelWidth = (int) juce::GlyphArrangement::getStringWidth ( distanceToTopHoveredLabel.getFont(), distanceString (lineToTopHoveredComponent)) + 15;

// todo draw on left or right side of line
auto labelCenterY = lineToTopHoveredComponent.getPointAlongLineProportionally (0.5f).getY();
Expand All @@ -429,7 +429,7 @@ namespace melatonin
// bottom
if (lineToBottomHoveredComponent.getLength() > 0)
{
int labelWidth = (int) distanceToBottomHoveredLabel.getFont().getStringWidthFloat (distanceString (lineToBottomHoveredComponent)) + 15;
int labelWidth = (int) juce::GlyphArrangement::getStringWidth ( distanceToBottomHoveredLabel.getFont(), distanceString (lineToBottomHoveredComponent)) + 15;

// todo draw on left or right side of line
auto labelCenterY = lineToBottomHoveredComponent.getPointAlongLineProportionally (0.5f).getY();
Expand All @@ -445,7 +445,7 @@ namespace melatonin
// right
if (lineToRightHoveredComponent.getLength() > 0)
{
int labelWidth = (int) distanceToRightHoveredLabel.getFont().getStringWidthFloat (distanceString (lineToRightHoveredComponent)) + 15;
int labelWidth = (int) juce::GlyphArrangement::getStringWidth ( distanceToRightHoveredLabel.getFont(), distanceString (lineToRightHoveredComponent)) + 15;

// todo draw on top or bottom side of line
auto labelCenterX = lineToRightHoveredComponent.getPointAlongLineProportionally (0.5f).getX();
Expand All @@ -461,7 +461,7 @@ namespace melatonin
// left
if (lineToLeftHoveredComponent.getLength() > 0)
{
int labelWidth = (int) distanceToLeftHoveredLabel.getFont().getStringWidthFloat (distanceString (lineToLeftHoveredComponent)) + 15;
int labelWidth = (int) juce::GlyphArrangement::getStringWidth ( distanceToLeftHoveredLabel.getFont(), distanceString (lineToLeftHoveredComponent)) + 15;

// todo draw on top or bottom side of line
auto labelCenterX = lineToLeftHoveredComponent.getPointAlongLineProportionally (0.5f).getX();
Expand Down
2 changes: 1 addition & 1 deletion melatonin/lookandfeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace melatonin

if (component.getProperties().getWithDefault ("isUserProperty", false))
{
auto textWidth = (float) g.getCurrentFont().getStringWidth (component.getName());
auto textWidth = (float) juce::GlyphArrangement::getStringWidth ( g.getCurrentFont(), component.getName());
auto tagBounds = juce::Rectangle<float> (3 + textWidth + 3, 7, 40, 14).toFloat();
g.setColour (colors::panelBackgroundDarker);
g.fillRoundedRectangle (tagBounds, 3);
Expand Down

0 comments on commit 4293b71

Please sign in to comment.