aboutsummaryrefslogtreecommitdiff
path: root/dw/fltkviewbase.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2012-09-14 11:34:19 +0200
committerSebastian Geerken <devnull@localhost>2012-09-14 11:34:19 +0200
commite4367b16dc131f34936bbb8fd09557b5aa5acbd7 (patch)
tree487a35941bf20bbc95a3d0b1dee420b00771f5b6 /dw/fltkviewbase.cc
parentabd446c2eebe1f96764b6d95f1c6c61ae9bc40b2 (diff)
parent94e451ffa5ece79a3b071ee553650bf8bd869a46 (diff)
Merge of <http://hg.dillo.org/dillo>.
Diffstat (limited to 'dw/fltkviewbase.cc')
-rw-r--r--dw/fltkviewbase.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc
index bf3aba22..240937e2 100644
--- a/dw/fltkviewbase.cc
+++ b/dw/fltkviewbase.cc
@@ -531,9 +531,9 @@ FltkWidgetView::~FltkWidgetView ()
}
void FltkWidgetView::drawText (core::style::Font *font,
- core::style::Color *color,
- core::style::Color::Shading shading,
- int X, int Y, const char *text, int len)
+ core::style::Color *color,
+ core::style::Color::Shading shading,
+ int X, int Y, const char *text, int len)
{
FltkFont *ff = (FltkFont*)font;
fl_font(ff->font, ff->size);
@@ -548,7 +548,7 @@ void FltkWidgetView::drawText (core::style::Font *font,
viewY = translateCanvasYToViewY (Y);
int curr = 0, next = 0, nb;
char chbuf[4];
- int c, cu;
+ int c, cu, width;
if (font->fontVariant == core::style::FONT_VARIANT_SMALL_CAPS) {
int sc_fontsize = lout::misc::roundInt(ff->size * 0.78);
@@ -558,24 +558,30 @@ void FltkWidgetView::drawText (core::style::Font *font,
if ((cu = fl_toupper(c)) == c) {
/* already uppercase, just draw the character */
fl_font(ff->font, ff->size);
+ width = (int)fl_width(text + curr, next - curr);
+ if (curr && width)
+ viewX += font->letterSpacing;
fl_draw(text + curr, next - curr, viewX, viewY);
- viewX += font->letterSpacing;
- viewX += (int)fl_width(text + curr, next - curr);
+ viewX += width;
} else {
/* make utf8 string for converted char */
nb = fl_utf8encode(cu, chbuf);
fl_font(ff->font, sc_fontsize);
+ width = (int)fl_width(chbuf, nb);
+ if (curr && width)
+ viewX += font->letterSpacing;
fl_draw(chbuf, nb, viewX, viewY);
- viewX += font->letterSpacing;
- viewX += (int)fl_width(chbuf, nb);
+ viewX += width;
}
}
} else {
while (next < len) {
next = theLayout->nextGlyph(text, curr);
+ width = (int)fl_width(text + curr, next - curr);
+ if (curr && width)
+ viewX += font->letterSpacing;
fl_draw(text + curr, next - curr, viewX, viewY);
- viewX += font->letterSpacing +
- (int)fl_width(text + curr,next - curr);
+ viewX += width;
curr = next;
}
}