diff options
Diffstat (limited to 'amiga')
-rw-r--r-- | amiga/font.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/amiga/font.c b/amiga/font.c index ee5ab303c..df0567f09 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -216,7 +216,7 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle, outf16 = utf16; if(!(ofont = ami_open_outline_font(fstyle, 0))) return false; - *char_offset = length; + *char_offset = 0; *actual_x = 0; while (utf8_pos < length) { @@ -239,17 +239,20 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle, } tx += tempx; + utf16 += utf16charlen; + utf8_pos = utf8_next(string, length, utf8_pos); if(tx < x) { *actual_x = tx; - } else { *char_offset = utf8_pos; + } else { + if((x - *actual_x) > (tx - x)) { + *actual_x = tx; + *char_offset = utf8_pos; + } free(outf16); return true; } - - utf16 += utf16charlen; - utf8_pos = utf8_next(string, length, utf8_pos); } *actual_x = tx; |