1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

ShapedText: Fix input text range calculation logic during wrapping

This commit is contained in:
attila 2025-02-03 17:03:40 +01:00 committed by Attila Szarvas
parent bfbdc4844d
commit a4f73a37af

View file

@ -635,6 +635,11 @@ public:
auto getTextRange() const { return textRange; }
const auto& getFont() const { return subOwnedGlyphsSpan.font; }
void setTextRange (Range<int64> newRange)
{
textRange = newRange;
}
private:
GlyphsStorage subOwnedGlyphsSpan;
Span<const ShapedGlyph> glyphs;
@ -931,9 +936,14 @@ struct Shaper
while (end < endIt && end->cluster < nextSoftBreakBefore)
++end;
const auto startingCluster = std::max (startFrom, start->cluster);
if (! result.empty())
result.back().setTextRange (result.back().getTextRange().withEnd (startingCluster));
result.push_back ({ glyphsIt->value,
Span<const ShapedGlyph> { start, (size_t) std::distance (start, end) },
{ startFrom, nextSoftBreakBefore },
{ startingCluster, nextSoftBreakBefore },
visualOrder[(size_t) start->cluster] });
if (end != endIt && end->cluster >= nextSoftBreakBefore)