aboutsummaryrefslogtreecommitdiffstats
path: root/libskrift_merge_glyphs.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-04-26 18:02:41 +0200
committerMattias Andrée <maandree@kth.se>2020-04-26 18:02:41 +0200
commit26203066cb324a6c4bb8e14ae4198d0ae21b4276 (patch)
treee9a1c24da7271ef714c8bceb403e3b71fb05b510 /libskrift_merge_glyphs.c
parentAdd autohinting and autokerning renders flags and prepare for fallback fonts (diff)
downloadlibskrift-26203066cb324a6c4bb8e14ae4198d0ae21b4276.tar.gz
libskrift-26203066cb324a6c4bb8e14ae4198d0ae21b4276.tar.bz2
libskrift-26203066cb324a6c4bb8e14ae4198d0ae21b4276.tar.xz
libskrift_merge_glyphs: support any pixel encoding
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libskrift_merge_glyphs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libskrift_merge_glyphs.c b/libskrift_merge_glyphs.c
index 548e8fb..76ddb6b 100644
--- a/libskrift_merge_glyphs.c
+++ b/libskrift_merge_glyphs.c
@@ -8,11 +8,12 @@ libskrift_merge_glyphs(LIBSKRIFT_CONTEXT *ctx, struct libskrift_glyph *glyph1,
struct libskrift_glyph *glyph2, struct libskrift_glyph **glyphp)
{
int16_t x1a, x1b, x2a, x2b, y1a, y1b, y2a, y2b, x1, x2, y1, y2;
- size_t width, height, r, c, size = 1, psize = 1;
+ size_t width, height, r, c, size, psize;
size_t src_off, dest_off, src_linesize, dest_linesize;
- if (ctx->rendering.smoothing == LIBSKRIFT_SUBPIXEL)
- size = psize = 3;
+ (void) ctx;
+
+ psize = glyph1->size / ((size_t)glyph1->width * (size_t)glyph1->height);
x1a = glyph1->x;
x1b = glyph2->x;
@@ -29,6 +30,7 @@ libskrift_merge_glyphs(LIBSKRIFT_CONTEXT *ctx, struct libskrift_glyph *glyph1,
x2 = MAX(x2a, x2b);
y2 = MAX(y2a, y2b);
+ size = psize;
size *= width = (uint16_t)(x2 - x1);
size *= height = (uint16_t)(y2 - y1);