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 b7ea195 commit a3efaa2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/gin_gui/components/gin_singlelinetexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SingleLineTextEditor::UniformTextSection
{
lastAtom->atomText += first->atomText;
lastAtom->numChars = (uint16_t) (lastAtom->numChars + first->numChars);
lastAtom->width = font.getStringWidthFloat (lastAtom->getText());
lastAtom->width = juce::GlyphArrangement::getStringWidth ( font, lastAtom->getText());
delete first;
++i;
}
Expand Down Expand Up @@ -125,13 +125,13 @@ class SingleLineTextEditor::UniformTextSection
TextAtom* const secondAtom = new TextAtom();

secondAtom->atomText = atom->atomText.substring (indexToBreakAt - index);
secondAtom->width = font.getStringWidthFloat (secondAtom->getText());
secondAtom->width = juce::GlyphArrangement::getStringWidth ( font, secondAtom->getText());
secondAtom->numChars = (uint16_t) secondAtom->atomText.length();

section2->atoms.add (secondAtom);

atom->atomText = atom->atomText.substring (0, indexToBreakAt - index);
atom->width = font.getStringWidthFloat (atom->getText());
atom->width = juce::GlyphArrangement::getStringWidth ( font, atom->getText());
atom->numChars = (uint16_t) (indexToBreakAt - index);

for (int j = i + 1; j < atoms.size(); ++j)
Expand Down Expand Up @@ -195,7 +195,7 @@ class SingleLineTextEditor::UniformTextSection
for (int i = atoms.size(); --i >= 0;)
{
TextAtom* const atom = atoms.getUnchecked(i);
atom->width = newFont.getStringWidthFloat (atom->getText());
atom->width = juce::GlyphArrangement::getStringWidth (newFont, atom->getText());
}
}
}
Expand Down Expand Up @@ -256,7 +256,7 @@ class SingleLineTextEditor::UniformTextSection
TextAtom* const atom = atoms.add (new TextAtom());

atom->atomText = juce::String (start, numChars);
atom->width = font.getStringWidthFloat (atom->getText());
atom->width = juce::GlyphArrangement::getStringWidth (font, atom->getText());
atom->numChars = (uint16_t) numChars;
}
}
Expand Down

0 comments on commit a3efaa2

Please sign in to comment.