diff options
author | Sebastian Geerken <devnull@localhost> | 2014-05-09 19:58:17 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-05-09 19:58:17 +0200 |
commit | 2a2541895cb4615c537d7858dd678c54a844b09e (patch) | |
tree | 4a5fa2e468383a2d0b148a3be6cadbdf5d0ef71d | |
parent | 7eac6f2a6a1909660cf652dc557bbb0fb90b213e (diff) |
Fixed handling of breaks for spaces.
-rw-r--r-- | dw/textblock.cc | 6 | ||||
-rw-r--r-- | dw/textblock.hh | 4 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index 0bd6a407..590ffb60 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2483,7 +2483,7 @@ void Textblock::setBreakOption (Word *word, core::style::Style *style, // TODO: lineMustBeBroken should be independent of the penalty // index? Otherwise, examine the last line. if (!word->badnessAndPenalty.lineMustBeBroken(0)) { - if (forceBreak || isBreakAllowed (word)) + if (forceBreak || isBreakAllowed (style)) word->badnessAndPenalty.setPenalties (breakPenalty1, breakPenalty2); else word->badnessAndPenalty.setPenalty (PENALTY_PROHIBIT_BREAK); @@ -2492,9 +2492,9 @@ void Textblock::setBreakOption (Word *word, core::style::Style *style, DBG_OBJ_MSG_END (); } -bool Textblock::isBreakAllowed (Word *word) +bool Textblock::isBreakAllowed (core::style::Style *style) { - switch (word->style->whiteSpace) { + switch (style->whiteSpace) { case core::style::WHITE_SPACE_NORMAL: case core::style::WHITE_SPACE_PRE_LINE: case core::style::WHITE_SPACE_PRE_WRAP: diff --git a/dw/textblock.hh b/dw/textblock.hh index 7b2028d8..41762557 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -608,7 +608,9 @@ protected: void fillSpace (int wordNo, core::style::Style *style); void setBreakOption (Word *word, core::style::Style *style, int breakPenalty1, int breakPenalty2, bool forceBreak); - bool isBreakAllowed (Word *word); + bool isBreakAllowedInWord (Word *word) + { return isBreakAllowed (word->style); } + bool isBreakAllowed (core::style::Style *style); int textWidth (const char *text, int start, int len, core::style::Style *style, bool isStart, bool isEnd); void calcTextSize (const char *text, size_t len, core::style::Style *style, diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 8b99ed1f..3f1101c0 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -1147,7 +1147,7 @@ bool Textblock::isHyphenationCandidate (Word *word) { return (word->flags & Word::CAN_BE_HYPHENATED) && word->style->x_lang[0] && - isBreakAllowed(word) && + isBreakAllowedInWord (word) && word->content.type == core::Content::TEXT && Hyphenator::isHyphenationCandidate (word->content.text); } |