aboutsummaryrefslogtreecommitdiff
path: root/dw/textblock.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-03-05 14:28:34 +0100
committerSebastian Geerken <devnull@localhost>2013-03-05 14:28:34 +0100
commit09cbe1a36c6ca2762d2e49f173db7ee4fb683448 (patch)
treeaaf322ad1388f2c8a507d1c6a51779c8dd025f24 /dw/textblock.cc
parent98465834b8b0e7c4a563e651a51befd2a2ab06ac (diff)
parente844f4119a6a5b144b18af4bcc841c816f575159 (diff)
Merge with main repo.
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r--dw/textblock.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 9d61e06e..03f15f63 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -1786,9 +1786,8 @@ void Textblock::addText (const char *text, size_t len,
if(i < numParts - 1) {
Word *word = words->getLastRef();
- word->badnessAndPenalty
- .setPenalties (penalties[partPenaltyIndex[i]][0],
- penalties[partPenaltyIndex[i]][1]);
+ setBreakOption (word, style, penalties[partPenaltyIndex[i]][0],
+ penalties[partPenaltyIndex[i]][1]);
if (charRemoved[i])
// Currently, only unconditional hyphens (UTF-8:
@@ -1982,7 +1981,7 @@ void Textblock::addBreakOption (core::style::Style *style)
{
int wordIndex = words->size () - 1;
if (wordIndex >= 0) {
- setBreakOption (words->getRef(wordIndex), style);
+ setBreakOption (words->getRef(wordIndex), style, 0, 0);
// Call of accumulateWordData() is not needed here.
correctLastWordExtremes ();
}
@@ -2008,7 +2007,7 @@ void Textblock::fillSpace (Word *word, core::style::Style *style)
// Do not override a previously set break penalty.
if (!word->content.space) {
- setBreakOption (word, style);
+ setBreakOption (word, style, 0, 0);
word->content.space = true;
word->effSpace = word->origSpace = style->font->spaceWidth +
@@ -2032,7 +2031,8 @@ void Textblock::fillSpace (Word *word, core::style::Style *style)
* (and so addSpace), but may be called, via addBreakOption(), as an
* alternative, e. g. for ideographic characters.
*/
-void Textblock::setBreakOption (Word *word, core::style::Style *style)
+void Textblock::setBreakOption (Word *word, core::style::Style *style,
+ int breakPenalty1, int breakPenalty2)
{
// TODO: lineMustBeBroken should be independent of the penalty
// index? Otherwise, examine the last line.
@@ -2041,7 +2041,7 @@ void Textblock::setBreakOption (Word *word, core::style::Style *style)
case core::style::WHITE_SPACE_NORMAL:
case core::style::WHITE_SPACE_PRE_LINE:
case core::style::WHITE_SPACE_PRE_WRAP:
- word->badnessAndPenalty.setPenalty (0);
+ word->badnessAndPenalty.setPenalties (breakPenalty1, breakPenalty2);
break;
case core::style::WHITE_SPACE_PRE: