aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-04-29 16:32:20 +0200
committerMattias Andrée <maandree@kth.se>2020-04-29 16:32:20 +0200
commit4c508aeb9ad88043d7bcda3554ba703bdc071658 (patch)
treedcad2d55a92d9c4b61cbdf6103c8c43f7f09d63f
parentm (diff)
downloadlibskrift-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>
-rw-r--r--README4
-rw-r--r--demo.c7
-rw-r--r--libskrift_create_context.c1
-rw-r--r--libskrift_draw_text.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/README b/README
index 49c6ee4..8059e10 100644
--- a/README
+++ b/README
@@ -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.
diff --git a/demo.c b/demo.c
index 0d0a866..0e9a6d4 100644
--- a/demo.c
+++ b/demo.c
@@ -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;