aboutsummaryrefslogtreecommitdiffstats
path: root/libskrift_draw_text.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-08-05 20:53:28 +0200
committerMattias Andrée <maandree@kth.se>2021-08-05 20:53:28 +0200
commita5fe9dab3f68668e3bc31326447139b7446edbc7 (patch)
tree5490cf70dacbf27406817bf759cecd61f7402219 /libskrift_draw_text.c
parentmake demo flexible + minor fixes (diff)
downloadlibskrift-a5fe9dab3f68668e3bc31326447139b7446edbc7.tar.gz
libskrift-a5fe9dab3f68668e3bc31326447139b7446edbc7.tar.bz2
libskrift-a5fe9dab3f68668e3bc31326447139b7446edbc7.tar.xz
Improvements for character transformations
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libskrift_draw_text.c')
-rw-r--r--libskrift_draw_text.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libskrift_draw_text.c b/libskrift_draw_text.c
index 75645ba..e827159 100644
--- a/libskrift_draw_text.c
+++ b/libskrift_draw_text.c
@@ -18,7 +18,7 @@ libskrift_draw_text(LIBSKRIFT_CONTEXT *ctx, const char *text, size_t text_length
struct libskrift_saved_grapheme saved = LIBSKRIFT_NO_SAVED_GRAPHEME;
struct libskrift_glyph *glyph;
char *buffer = NULL;
- double xpos = 0, ypos = 0;
+ double xpos = 0, ypos = 0, advance;
ssize_t len;
int r;
@@ -44,8 +44,10 @@ libskrift_draw_text(LIBSKRIFT_CONTEXT *ctx, const char *text, size_t text_length
}
r = libskrift_apply_glyph(ctx, glyph, colour, x, y, image);
- xpos += (glyph->advance + ctx->rendering.interletter_spacing) * ctx->x_advancement;
- ypos += (glyph->advance + ctx->rendering.interletter_spacing) * ctx->y_advancement;
+ advance = glyph->advance * ctx->char_x_advancement;
+ advance += ctx->rendering.interletter_spacing;
+ xpos += advance * ctx->text_x_advancement;
+ ypos += advance * ctx->text_y_advancement;
free(glyph);
if (r) {
free(buffer);