diff options
author | sgeerken <devnull@localhost> | 2012-06-25 01:18:42 +0200 |
---|---|---|
committer | sgeerken <devnull@localhost> | 2012-06-25 01:18:42 +0200 |
commit | 7729de9ba89ea555b2f8b6d4adda8f86a112d082 (patch) | |
tree | c56615baaa5f52a041c9872b36a274f4160db30f /dw | |
parent | 97efe140e92f31bbd224f66bda1af904e210692d (diff) |
Base of the line width is now effSpace, not origSpace, since the former may be smaller than the latter, when shrinkability is > 0. Fixes lines which are too long.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/textblock.cc | 12 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 8 |
2 files changed, 16 insertions, 4 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index df0b926e..826b6648 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -142,6 +142,9 @@ void Textblock::sizeRequestImpl (core::Requisition *requisition) Line *lastLine = lines->getRef (lines->size () - 1); requisition->width = lastLine->maxLineWidth; + PRINTF ("[%p] SIZE_REQUEST: lastLine->maxLineWidth = %d\n", + this, lastLine->maxLineWidth); + PRINTF ("[%p] SIZE_REQUEST: lines[0]->boxAscent = %d\n", this, lines->getRef(0)->boxAscent); PRINTF ("[%p] SIZE_REQUEST: lines[%d]->top = %d\n", @@ -163,6 +166,9 @@ void Textblock::sizeRequestImpl (core::Requisition *requisition) requisition->descent = 0; } + PRINTF ("[%p] SIZE_REQUEST: inner padding = %d, boxDiffWidth = %d\n", + this, innerPadding, getStyle()->boxDiffWidth ()); + requisition->width += innerPadding + getStyle()->boxDiffWidth (); requisition->ascent += getStyle()->boxOffsetY (); requisition->descent += getStyle()->boxRestHeight (); @@ -170,8 +176,8 @@ void Textblock::sizeRequestImpl (core::Requisition *requisition) if (requisition->width < availWidth) requisition->width = availWidth; - PRINTF("[%p] SIZE_REQUEST: %d x %d + %d\n", this, requisition->width, - requisition->ascent, requisition->descent); + PRINTF ("[%p] SIZE_REQUEST: %d x %d + %d\n", this, requisition->width, + requisition->ascent, requisition->descent); } /** @@ -1495,7 +1501,7 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) * end of this function, the correct value is assigned. */ widget->parentRef = -1; - PRINTF("%p becomes child of %p\n", widget, this); + PRINTF ("%p becomes child of %p\n", widget, this); widget->setParent (this); widget->setStyle (style); diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 92f8b3bb..5ca556c8 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -261,6 +261,13 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, line->breakSpace = 0; line->leftOffset = 0; + alignLine (line); + for (int i = line->firstWord; i < line->lastWord; i++) { + Word *word = words->getRef (i); + lineWidth += (word->effSpace - word->origSpace); + } + + if (lines->size () == 1) { line->top = 0; @@ -301,7 +308,6 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, PRINTF (" line[%d].contentDescent = %d\n", lines->size () - 1, line->contentDescent); - alignLine (line); mustQueueResize = true; return line; |