aboutsummaryrefslogtreecommitdiff
path: root/dw/textblock_linebreaking.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-12-08 17:35:18 +0100
committerSebastian Geerken <devnull@localhost>2014-12-08 17:35:18 +0100
commit3d521d286174264448cbd1b2315ff89f9d8e8edf (patch)
tree37515aa58dc935014b677c7212ada0fdfab7b2bd /dw/textblock_linebreaking.cc
parentde2139f76ee1fa4f14970914bb6c87fe46feed17 (diff)
parent2bb03c759cb44241d42e3385336a1c6b9a8d7d9f (diff)
Merged with main repo (part 1/2).
Diffstat (limited to 'dw/textblock_linebreaking.cc')
-rw-r--r--dw/textblock_linebreaking.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index cdd99197..5cc6ad65 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -1735,7 +1735,7 @@ void Textblock::alignLine (int lineIndex)
this->lineBreakWidth - (line->leftOffset + line->rightOffset);
for (int i = line->firstWord; i < line->lastWord; i++)
- words->getRef(i)->origSpace = words->getRef(i)->effSpace;
+ words->getRef(i)->effSpace = words->getRef(i)->origSpace;
if (firstWord->content.type != core::Content::BREAK) {
switch (firstWord->style->textAlign) {
@@ -2130,8 +2130,23 @@ void Textblock::showMissingLines ()
void Textblock::removeTemporaryLines ()
{
- lines->setSize (nonTemporaryLines);
- DBG_OBJ_SET_NUM ("lines.size", lines->size ());
+ DBG_OBJ_ENTER0 ("construct.line", 0, "removeTemporaryLines");
+
+ if (nonTemporaryLines < lines->size ()) {
+ lines->setSize (nonTemporaryLines);
+ DBG_OBJ_SET_NUM ("lines.size", lines->size ());
+
+ // For words which will be added, the values calculated before in
+ // accumulateWordData() are wrong, so it is called again. (Actually, the
+ // words from the first temporary line are correct, but for simplicity,
+ // we re-calculate all.)
+ int firstWord =
+ lines->size () > 0 ? lines->getLastRef()->lastWord + 1 : 0;
+ for (int i = firstWord; i < words->size (); i++)
+ accumulateWordData (i);
+ }
+
+ DBG_OBJ_LEAVE ();
}
int Textblock::getSpaceShrinkability(struct Word *word)