aboutsummaryrefslogtreecommitdiffstats
path: root/libskrift_draw_text.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-04-29 16:17:26 +0200
committerMattias Andrée <maandree@kth.se>2020-04-29 16:17:26 +0200
commit9483b5bc87f88bdd76a5e2be5a2ca6414a62820d (patch)
tree0cd26d7ed956374ef5658aeada571d72246e3b1f /libskrift_draw_text.c
parentAdd support for character mirroring and add functions for creating transformations (diff)
downloadlibskrift-9483b5bc87f88bdd76a5e2be5a2ca6414a62820d.tar.gz
libskrift-9483b5bc87f88bdd76a5e2be5a2ca6414a62820d.tar.bz2
libskrift-9483b5bc87f88bdd76a5e2be5a2ca6414a62820d.tar.xz
Add support for text-level transformation
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libskrift_draw_text.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libskrift_draw_text.c b/libskrift_draw_text.c
index 8f46df4..95fd523 100644
--- a/libskrift_draw_text.c
+++ b/libskrift_draw_text.c
@@ -7,17 +7,18 @@ libskrift_draw_text(LIBSKRIFT_CONTEXT *ctx, const char *text, const struct libsk
{
struct libskrift_saved_grapheme saved = LIBSKRIFT_NO_SAVED_GRAPHEME;
struct libskrift_glyph *glyph;
- double xpos = 0;
+ double xpos = 0, ypos = 0;
ssize_t len;
int r;
for (; *text; text += len) {
- len = libskrift_get_cluster_glyph(ctx, text, &saved, xpos, 0, &glyph);
+ len = libskrift_get_cluster_glyph(ctx, text, &saved, xpos, ypos, &glyph);
if (len < 0)
return -1;
r = libskrift_apply_glyph(ctx, glyph, colour, x, y, image);
- xpos += glyph->advance;
+ xpos += glyph->advance * ctx->x_advancement;
+ ypos += glyph->advance * ctx->y_advancement;
free(glyph);
if (r)
return -1;