diff options
author | Mattias Andrée <maandree@kth.se> | 2020-04-29 16:32:20 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-04-29 16:32:20 +0200 |
commit | 4c508aeb9ad88043d7bcda3554ba703bdc071658 (patch) | |
tree | dcad2d55a92d9c4b61cbdf6103c8c43f7f09d63f | |
parent | m (diff) | |
download | libskrift-4c508aeb9ad88043d7bcda3554ba703bdc071658.tar.gz libskrift-4c508aeb9ad88043d7bcda3554ba703bdc071658.tar.bz2 libskrift-4c508aeb9ad88043d7bcda3554ba703bdc071658.tar.xz |
Add support for inter-letter spacing
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | demo.c | 7 | ||||
-rw-r--r-- | libskrift_create_context.c | 1 | ||||
-rw-r--r-- | libskrift_draw_text.c | 4 |
4 files changed, 8 insertions, 8 deletions
@@ -38,6 +38,8 @@ Currently implemented: Affine transformations on glyphs and texts. + Inter-character spacing. + Not implemented yet @@ -53,8 +55,6 @@ Not implemented yet Vertical text. - Inter-character spacing. - Text shaping. Font searching. @@ -15,9 +15,10 @@ main(void) double height; size_t size, i; - rendering.smoothing = LIBSKRIFT_SUBPIXEL; - rendering.subpixel_order = LIBSKRIFT_NONE; - rendering.flags = LIBSKRIFT_MIRROR_CHARS * 0; + rendering.smoothing = LIBSKRIFT_SUBPIXEL; + rendering.subpixel_order = LIBSKRIFT_NONE; + rendering.flags = LIBSKRIFT_MIRROR_CHARS * 0; + rendering.interletter_spacing = -5; if (libskrift_open_font_file(&font, DEMO_FONT)) { perror("libskrift_open_font_file"); diff --git a/libskrift_create_context.c b/libskrift_create_context.c index f034240..c1732c0 100644 --- a/libskrift_create_context.c +++ b/libskrift_create_context.c @@ -103,7 +103,6 @@ libskrift_create_context(LIBSKRIFT_CONTEXT **ctxp, LIBSKRIFT_FONT **fonts, size_ (*ctxp)->rendering.flags |= LIBSKRIFT_REMOVE_GAMMA; /* libschrift does not add gamma */ (*ctxp)->rendering.grid_fineness = 1; (*ctxp)->rendering.kerning = 0; - (*ctxp)->rendering.interletter_spacing = 0; if (!(*ctxp)->rendering.smoothing) (*ctxp)->rendering.smoothing = LIBSKRIFT_GREYSCALE; diff --git a/libskrift_draw_text.c b/libskrift_draw_text.c index 95fd523..05f278c 100644 --- a/libskrift_draw_text.c +++ b/libskrift_draw_text.c @@ -17,8 +17,8 @@ libskrift_draw_text(LIBSKRIFT_CONTEXT *ctx, const char *text, const struct libsk return -1; r = libskrift_apply_glyph(ctx, glyph, colour, x, y, image); - xpos += glyph->advance * ctx->x_advancement; - ypos += glyph->advance * ctx->y_advancement; + xpos += (glyph->advance + ctx->rendering.interletter_spacing) * ctx->x_advancement; + ypos += (glyph->advance + ctx->rendering.interletter_spacing) * ctx->y_advancement; free(glyph); if (r) return -1; |