aboutsummaryrefslogtreecommitdiffstats
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
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--.gitignore2
-rw-r--r--libskrift_merge_glyphs.c8
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);