diff options
author | Sebastian Geerken <devnull@localhost> | 2012-11-26 23:00:11 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2012-11-26 23:00:11 +0100 |
commit | bccc6503f4677953a8cd2bbac2c962dc432577d9 (patch) | |
tree | 345656d8a7954c4ef702b9e443a4d4cf83bdad85 | |
parent | d9bccd6d15eb017964fbdfc3aba428dfbc4764b2 (diff) |
Draw unconditional hyphens instead of soft hyphens.
-rw-r--r-- | dw/textblock.cc | 12 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index 045126d9..0d8a6a3e 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -928,7 +928,7 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2, totalWidth += w->size.width; } - char text[l + (drawHyphen ? 2 : 0) + 1]; + char text[l + (drawHyphen ? 3 : 0) + 1]; int p = 0; for (int i = wordIndex1; i <= wordIndex2; i++) { const char * t = words->getRef(i)->content.text; @@ -937,8 +937,10 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2, } if(drawHyphen) { - text[p++] = 0xc2; - text[p++] = 0xad; + // "\xe2\x80\x90" is an unconditional hyphen. + text[p++] = 0xe2; + text[p++] = 0x80; + text[p++] = 0x90; text[p++] = 0; } @@ -1707,8 +1709,10 @@ void Textblock::addHyphen () Word *word = words->getRef(wordIndex); word->badnessAndPenalty.setPenalty (HYPHEN_BREAK); + // "\xe2\x80\x90" is an unconditional hyphen. // TODO Optimize? Like spaces? - word->hyphenWidth = layout->textWidth (word->style->font, "\xc2\xad", 2); + word->hyphenWidth = + layout->textWidth (word->style->font, "\xe2\x80\x90", 3); accumulateWordData (wordIndex); } diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 81cab950..a203f5a4 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -691,8 +691,9 @@ int Textblock::hyphenateWord (int wordIndex) if (i < numBreaks) { // TODO There should be a method fillHyphen. w->badnessAndPenalty.setPenalty (HYPHEN_BREAK); + // "\xe2\x80\x90" is an unconditional hyphen. w->hyphenWidth = - layout->textWidth (origWord.style->font, "\xc2\xad", 2); + layout->textWidth (origWord.style->font, "\xe2\x80\x90", 3); PRINTF (" [%d] + hyphen\n", wordIndex + i); } else { if (origWord.content.space) { |