diff options
author | Mattias Andrée <maandree@kth.se> | 2020-04-28 18:47:10 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-04-28 18:47:10 +0200 |
commit | 9761455b328c86d8caedbf2f8ebd1bec8936e749 (patch) | |
tree | 81dd4f0982ae15a4dfe9f15ff5ce9342756f5a81 /libskrift_merge_glyphs.c | |
parent | Add code (untested) for applying glyphs to an image (diff) | |
download | libskrift-9761455b328c86d8caedbf2f8ebd1bec8936e749.tar.gz libskrift-9761455b328c86d8caedbf2f8ebd1bec8936e749.tar.bz2 libskrift-9761455b328c86d8caedbf2f8ebd1bec8936e749.tar.xz |
Fix drawing issues (there is still some left)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libskrift_merge_glyphs.c')
-rw-r--r-- | libskrift_merge_glyphs.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libskrift_merge_glyphs.c b/libskrift_merge_glyphs.c index 6c62fc8..4df6f7a 100644 --- a/libskrift_merge_glyphs.c +++ b/libskrift_merge_glyphs.c @@ -10,9 +10,24 @@ libskrift_merge_glyphs(LIBSKRIFT_CONTEXT *ctx, const struct libskrift_glyph *gly int16_t x1a, x1b, x2a, x2b, y1a, y1b, y2a, y2b, x1, x2, y1, y2; size_t width, height, r, c, size, psize; size_t src_off, dest_off, src_linesize, dest_linesize; + const struct libskrift_glyph *t; psize = ctx->rendering.smoothing ? 3 : 1; + if (!(glyph1->width | glyph1->height)) { + t = glyph1; + glyph1 = glyph2; + glyph2 = t; + } + if (!(glyph2->width | glyph2->height)) { + size = offsetof(struct libskrift_glyph, image) + glyph1->size; + *glyphp = calloc(1, size); + if (!*glyphp) + return -1; + memcpy(*glyphp, glyph1, size); + return 0; + } + x1a = glyph1->x; x1b = glyph2->x; y1a = glyph1->y; |