aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-08-05 21:01:19 +0200
committerMattias Andrée <maandree@kth.se>2021-08-05 21:01:19 +0200
commitceba3198ea95f78c4950acf18bdb432275404810 (patch)
tree0be2c82c24a5554b50c5c2e1e84d3ecd05178c49
parentImprovements for character transformations (diff)
downloadlibskrift-ceba3198ea95f78c4950acf18bdb432275404810.tar.gz
libskrift-ceba3198ea95f78c4950acf18bdb432275404810.tar.bz2
libskrift-ceba3198ea95f78c4950acf18bdb432275404810.tar.xz
Add support for horizontal blanking interval in output images
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--demo.c2
-rw-r--r--libskrift.h3
-rw-r--r--libskrift_apply_glyph.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/demo.c b/demo.c
index e7d4eec..7673314 100644
--- a/demo.c
+++ b/demo.c
@@ -307,7 +307,7 @@ main(int argc, char *argv[])
{
LIBSKRIFT_FONT *font;
LIBSKRIFT_CONTEXT *ctx;
- struct libskrift_image image = {LIBSKRIFT_R8G8B8A8, LIBSKRIFT_BE_SUBPIXEL, 0, 800, 600, NULL, NULL, NULL};
+ struct libskrift_image image = {LIBSKRIFT_R8G8B8A8, LIBSKRIFT_BE_SUBPIXEL, 0, 800, 600, 0, NULL, NULL, NULL};
struct libskrift_rendering rendering = LIBSKRIFT_DEFAULT_RENDERING;
struct libskrift_colour colour;
const char *font_file = DEMO_FONT;
diff --git a/libskrift.h b/libskrift.h
index 4873d7d..4c8cd25 100644
--- a/libskrift.h
+++ b/libskrift.h
@@ -145,12 +145,13 @@ struct libskrift_saved_grapheme {
size_t len;
};
-struct libskrift_image { /* TODO need horizontal blanking */
+struct libskrift_image {
enum libskrift_format format;
enum libskrift_endian endian;
int premultiplied;
uint16_t width;
uint16_t height;
+ size_t hblanking;
void (*preprocess)(struct libskrift_image *image, size_t x, size_t y, size_t width, size_t height);
void (*postprocess)(struct libskrift_image *image, size_t x, size_t y, size_t width, size_t height);
void *image;
diff --git a/libskrift_apply_glyph.c b/libskrift_apply_glyph.c
index 3fc3fc5..6e61732 100644
--- a/libskrift_apply_glyph.c
+++ b/libskrift_apply_glyph.c
@@ -99,7 +99,7 @@ libskrift_apply_glyph(LIBSKRIFT_CONTEXT *ctx, const struct libskrift_glyph *glyp
endc = (uint16_t)((int16_t)x2 - sx1);
endr = (uint16_t)((int16_t)y2 - sy1);
- img_linesize = (size_t)image->width * psize;
+ img_linesize = (size_t)image->width * psize + image->hblanking;
img_start += (size_t)y1 * img_linesize;
img_start += (size_t)x1 * psize;