diff options
-rw-r--r-- | dw/textblock.hh | 8 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 19 |
2 files changed, 23 insertions, 4 deletions
diff --git a/dw/textblock.hh b/dw/textblock.hh index 41762557..5e6929a7 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -307,13 +307,13 @@ protected: hyphen width etc.) since the last possible break within this paragraph. */ int parMax; /* The sum of all word maxima in this - * paragraph (plus spaces, hyphen width - * etc.). */ + paragraph (plus spaces, hyphen width + etc.). */ int maxParMin; /* Maximum of all paragraph minima (value of - * "parMin), including this paragraph. */ + "parMin"), including this paragraph. */ int maxParMax; /* Maximum of all paragraph maxima (value of - * "parMax"), including this paragraph. */ + "parMax""), including this paragraph. */ }; struct Line diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 3f1101c0..09b583a1 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -529,6 +529,9 @@ void Textblock::accumulateWordExtremes (int firstWord, int lastWord, void Textblock::processWord (int wordIndex) { + DBG_OBJ_MSGF ("construct.word", 0, "<b>processWord</b> (%d)", wordIndex); + DBG_OBJ_MSG_START (); + bool wordListChanged = wordWrap (wordIndex, false); if (wordListChanged) { @@ -537,19 +540,35 @@ void Textblock::processWord (int wordIndex) // more than one time (original un-hyphenated word, plus all // parts of the hyphenated word, except the first one), the // whole paragraph is recalculated again. + // + // (Note: the hyphenated word is often *before* wordIndex, and + // it may be even more than one word, which makes it nearly + // impossible to reconstruct what has happend. Therefore, there + // is no simpler approach to handle this.) + + DBG_OBJ_MSG ("construct.paragraph", 1, "word list has changed"); int firstWord; if (paragraphs->size() > 0) { firstWord = paragraphs->getLastRef()->firstWord; paragraphs->setSize (paragraphs->size() - 1); + DBG_OBJ_MSG ("construct.paragraph", 1, "removing last paragraph"); } else firstWord = 0; + DBG_OBJ_MSGF ("construct.paragraph", 1, + "processing words again from %d to %d", + firstWord, wordIndex - 1); + + DBG_OBJ_MSG_START (); for (int i = firstWord; i <= wordIndex - 1; i++) handleWordExtremes (i); + DBG_OBJ_MSG_END (); } handleWordExtremes (wordIndex); + + DBG_OBJ_MSG_END (); } /* |