Skip to content

Commit 7d7fbac

Browse files
author
Jean Ghali
committed
#13884: Numbered list auto-indentation doesn't work with prefix or suffix
git-svn-id: svn://scribus.net/branches/Version16x/Scribus@26132 11d20701-8431-0410-a711-e3c959e3b870
1 parent f3d5a90 commit 7d7fbac

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

scribus/pageitem_textframe.cpp

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,16 @@ void PageItem_TextFrame::layout()
14431443
BulNumMode = false;
14441444
if (itemText.isBlockStart(a))
14451445
{
1446-
autoLeftIndent = 0.0;
1446+
if (currentIndex > 0)
1447+
{
1448+
int prevA = current.glyphs[currentIndex - 1].firstChar();
1449+
if (a != prevA)
1450+
autoLeftIndent = 0.0;
1451+
}
1452+
else
1453+
{
1454+
autoLeftIndent = 0.0;
1455+
}
14471456
style = itemText.paragraphStyle(a);
14481457
if (style.hasBullet() || style.hasNum())
14491458
{
@@ -1792,7 +1801,15 @@ void PageItem_TextFrame::layout()
17921801
{
17931802
if (style.parEffectIndent())
17941803
{
1795-
current.leftIndent -= style.parEffectOffset() + wide;
1804+
double effectWidth = 0.0;
1805+
for (int j = i; shapedText.haveMoreText(j, glyphClusters); ++j)
1806+
{
1807+
const auto& glyph = glyphClusters[j];
1808+
if (glyph.firstChar() != a)
1809+
break;
1810+
effectWidth += glyph.width();
1811+
}
1812+
current.leftIndent -= style.parEffectOffset() + effectWidth;
17961813
if (current.leftIndent < 0.0)
17971814
{
17981815
autoLeftIndent = abs(current.leftIndent);
@@ -2365,18 +2382,16 @@ void PageItem_TextFrame::layout()
23652382
if ((DropCmode || BulNumMode) && !outs)
23662383
{
23672384
current.xPos += style.parEffectOffset();
2368-
if (style.hasNum())
2385+
// for bulleted lists, make sure offset is applied only after last bullet char
2386+
// for numbered lists, make sure that offset is applied only after the suffix
2387+
// loop over previous current.glyphs and set their extraWidth to 0.0
2388+
for (int j = 0; j < current.glyphs.size(); j++)
23692389
{
2370-
// make sure that Offset inserted only after the suffix
2371-
// loop over previous current.glyphs and set their extraWidth to 0.0
2372-
for (int j = 0; j < current.glyphs.size(); j++)
2390+
if (j != currentIndex)
23732391
{
2374-
if (j != currentIndex)
2375-
{
2376-
GlyphCluster& currentGlyph = current.glyphs[j];
2377-
current.xPos -= currentGlyph.extraWidth;
2378-
currentGlyph.extraWidth = 0.0;
2379-
}
2392+
GlyphCluster& currentGlyph = current.glyphs[j];
2393+
current.xPos -= currentGlyph.extraWidth;
2394+
currentGlyph.extraWidth = 0.0;
23802395
}
23812396
}
23822397
// set the offset for Drop Cap, Bullet & Number List

0 commit comments

Comments
 (0)