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:
parent
bfbdc4844d
commit
a4f73a37af
1 changed files with 11 additions and 1 deletions
|
|
@ -635,6 +635,11 @@ public:
|
||||||
auto getTextRange() const { return textRange; }
|
auto getTextRange() const { return textRange; }
|
||||||
const auto& getFont() const { return subOwnedGlyphsSpan.font; }
|
const auto& getFont() const { return subOwnedGlyphsSpan.font; }
|
||||||
|
|
||||||
|
void setTextRange (Range<int64> newRange)
|
||||||
|
{
|
||||||
|
textRange = newRange;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GlyphsStorage subOwnedGlyphsSpan;
|
GlyphsStorage subOwnedGlyphsSpan;
|
||||||
Span<const ShapedGlyph> glyphs;
|
Span<const ShapedGlyph> glyphs;
|
||||||
|
|
@ -931,9 +936,14 @@ struct Shaper
|
||||||
while (end < endIt && end->cluster < nextSoftBreakBefore)
|
while (end < endIt && end->cluster < nextSoftBreakBefore)
|
||||||
++end;
|
++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,
|
result.push_back ({ glyphsIt->value,
|
||||||
Span<const ShapedGlyph> { start, (size_t) std::distance (start, end) },
|
Span<const ShapedGlyph> { start, (size_t) std::distance (start, end) },
|
||||||
{ startFrom, nextSoftBreakBefore },
|
{ startingCluster, nextSoftBreakBefore },
|
||||||
visualOrder[(size_t) start->cluster] });
|
visualOrder[(size_t) start->cluster] });
|
||||||
|
|
||||||
if (end != endIt && end->cluster >= nextSoftBreakBefore)
|
if (end != endIt && end->cluster >= nextSoftBreakBefore)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue