diff options
author | corvid <corvid@lavabit.com> | 2010-04-07 22:03:42 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2010-04-07 22:03:42 +0000 |
commit | 865148221562ff526c12a0805c0ab5ea5c859b29 (patch) | |
tree | c290c3891e46c16c0332720cf9d65d6ae57722cf /dw/textblock.cc | |
parent | 2ab82385183f9aa12d9d0e05b58de3ce02b093bb (diff) |
handle sup/sub alignment in content ascent/descent
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r-- | dw/textblock.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index c30c0d48..b2772084 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -859,7 +859,7 @@ void Textblock::wordWrap(int wordIndex) { Line *lastLine; Word *word; - int availWidth, lastSpace, leftOffset; + int availWidth, lastSpace, leftOffset, len; bool newLine = false, newPar = false; core::Extremes wordExtremes; @@ -933,10 +933,16 @@ void Textblock::wordWrap(int wordIndex) lastLine->lastWord = wordIndex; lastLine->boxAscent = misc::max (lastLine->boxAscent, word->size.ascent); lastLine->boxDescent = misc::max (lastLine->boxDescent, word->size.descent); - lastLine->contentAscent = misc::max (lastLine->contentAscent, - word->style->font->ascent); - lastLine->contentDescent = misc::max (lastLine->contentDescent, - word->style->font->descent); + + len = word->style->font->ascent; + if (word->style->valign == core::style::VALIGN_SUPER) + len += len / 2; + lastLine->contentAscent = misc::max (lastLine->contentAscent, len); + + len = word->style->font->descent; + if (word->style->valign == core::style::VALIGN_SUB) + len += word->style->font->ascent / 3; + lastLine->contentDescent = misc::max (lastLine->contentDescent, len); //DBG_OBJ_ARRSET_NUM (page, "lines.%d.ascent", page->num_lines - 1, // lastLine->boxAscent); |