mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
SimpleShapedText: Restore and tidy up earlier line breaking logic
This commit isn't fixing any known bugs, but restores the soft break
iteration logic to its state prior to
5e4016b4fb, which accidentally changed it.
This commit is contained in:
parent
b545b79cb3
commit
bd14d47211
1 changed files with 6 additions and 4 deletions
|
|
@ -1035,7 +1035,7 @@ void SimpleShapedText::shape (const String& data,
|
|||
ConsumableGlyphs glyphsToConsume { data, range, shapingParams };
|
||||
|
||||
const auto appendingToFirstLine = [&] { return lineNumbers.isEmpty(); };
|
||||
const auto appendingToLastLine = [&] { return (int64) lineNumbers.size() == options.getMaxNumLines() - 1; };
|
||||
const auto appendingToBeforeLastLine = [&] { return (int64) lineNumbers.size() < options.getMaxNumLines() - 1; };
|
||||
|
||||
while (! glyphsToConsume.isEmpty())
|
||||
{
|
||||
|
|
@ -1060,7 +1060,7 @@ void SimpleShapedText::shape (const String& data,
|
|||
static constexpr auto floatMax = std::numeric_limits<float>::max();
|
||||
|
||||
for (auto breakBefore = softBreakIterator.next();
|
||||
breakBefore.has_value() && (appendingToFirstLine() || ! appendingToLastLine());
|
||||
breakBefore.has_value() && (appendingToFirstLine() || appendingToBeforeLastLine());
|
||||
breakBefore = softBreakIterator.next())
|
||||
{
|
||||
if (auto safeAdvance = glyphsToConsume.getAdvanceXUpToBreakPointIfSafe (*breakBefore,
|
||||
|
|
@ -1218,8 +1218,10 @@ void SimpleShapedText::shape (const String& data,
|
|||
|
||||
while (! glyphsToAdd.glyphs.empty())
|
||||
{
|
||||
const auto appendingToLastLine = ! appendingToBeforeLastLine();
|
||||
|
||||
glyphsToAdd = addGlyphsToLine (glyphsToAdd,
|
||||
(appendingToLastLine() || ! options.getAllowBreakingInsideWord()) ? CanAddGlyphsBeyondLineLimits::yes
|
||||
(appendingToLastLine || ! options.getAllowBreakingInsideWord()) ? CanAddGlyphsBeyondLineLimits::yes
|
||||
: CanAddGlyphsBeyondLineLimits::no);
|
||||
|
||||
if (! glyphsToAdd.glyphs.empty())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue