summaryrefslogtreecommitdiff
path: root/dw/fltkplatform.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2011-10-25 20:30:06 +0000
committercorvid <corvid@lavabit.com>2011-10-25 20:30:06 +0000
commit37e403c6422091c5e0a8c54d94a2e176509bde3a (patch)
tree0df4132419229664e109138c0e77f66dc13246e2 /dw/fltkplatform.cc
parent789bccfa3ea03a59d1e1262ff7b6ddbf362697e7 (diff)
fix letter-spacing with combining characters
Diffstat (limited to 'dw/fltkplatform.cc')
-rw-r--r--dw/fltkplatform.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc
index cc093d37..5c69a4ec 100644
--- a/dw/fltkplatform.cc
+++ b/dw/fltkplatform.cc
@@ -525,14 +525,18 @@ int FltkPlatform::textWidth (core::style::Font *font, const char *text,
if ((cu = fl_toupper(c)) == c) {
/* already uppercase, just draw the character */
fl_font(ff->font, ff->size);
- width += font->letterSpacing;
- width += (int)fl_width(text + curr, next - curr);
+ if (fl_nonspacing(cu) == 0) {
+ width += font->letterSpacing;
+ width += (int)fl_width(text + curr, next - curr);
+ }
} else {
/* make utf8 string for converted char */
nb = fl_utf8encode(cu, chbuf);
fl_font(ff->font, sc_fontsize);
- width += font->letterSpacing;
- width += (int)fl_width(chbuf, nb);
+ if (fl_nonspacing(cu) == 0) {
+ width += font->letterSpacing;
+ width += (int)fl_width(chbuf, nb);
+ }
}
}
} else {
@@ -544,7 +548,9 @@ int FltkPlatform::textWidth (core::style::Font *font, const char *text,
while (next < len) {
next = nextGlyph(text, curr);
- width += font->letterSpacing;
+ c = fl_utf8decode(text + curr, text + next, &nb);
+ if (fl_nonspacing(c) == 0)
+ width += font->letterSpacing;
curr = next;
}
}