From 26203066cb324a6c4bb8e14ae4198d0ae21b4276 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 26 Apr 2020 18:02:41 +0200 Subject: libskrift_merge_glyphs: support any pixel encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 2 +- libskrift_merge_glyphs.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 28edc93..b9f3a77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -\#*\# +*\#* *~ *.o *.a 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); -- cgit v1.2.3-70-g09d2