summaryrefslogtreecommitdiff
path: root/dw/textblock.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-02-09 15:02:58 -0300
committercorvid <corvid@lavabit.com>2009-02-09 15:02:58 -0300
commitce5d23d0e0529cb7a623ffe48ccb074adaf40585 (patch)
tree40743673a01050c5519f9d9a059eec3696f690b8 /dw/textblock.cc
parente32686c10a4f4fe7c34b181845220b5c491f32fb (diff)
Fixed offset calculation for overlined <SUP>ed text
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r--dw/textblock.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index b80afb86..35d6caed 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -1257,9 +1257,12 @@ void Textblock::drawLine (Line *line, core::View *view, core::Rectangle *area)
/* Adjust the text baseline if the word is <SUP>-ed or <SUB>-ed. */
if (word->style->valign == core::style::VALIGN_SUB)
diff = word->size.ascent / 2;
- else if (word->style->valign == core::style::VALIGN_SUPER)
+ else if (word->style->valign == core::style::VALIGN_SUPER) {
+ /* calcTextSize increased word->size.ascent by 50%, so
+ * use 1/3 for 1/2 of original value.
+ */
diff -= word->size.ascent / 3;
-
+ }
/* Draw background (color, image), when given. */
if (word->style->hasBackground () && word->size.width > 0)
drawBox (view, word->style, area,
@@ -1587,7 +1590,7 @@ void Textblock::calcTextSize (const char *text, core::style::Style *style,
if (style->valign == core::style::VALIGN_SUB)
size->descent += (size->ascent / 2);
else if (style->valign == core::style::VALIGN_SUPER)
- size->ascent += (size->ascent / 3);
+ size->ascent += (size->ascent / 2);
}