diff options
author | Mattias Andrée <maandree@kth.se> | 2020-04-26 16:46:56 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-04-26 16:47:00 +0200 |
commit | 099c377b4ca3dacfd15ef3632108378a9d9081c6 (patch) | |
tree | 8cdcc4a65e49122a616e4121cc0e051fdacdf440 | |
parent | First commit (diff) | |
download | libskrift-099c377b4ca3dacfd15ef3632108378a9d9081c6.tar.gz libskrift-099c377b4ca3dacfd15ef3632108378a9d9081c6.tar.bz2 libskrift-099c377b4ca3dacfd15ef3632108378a9d9081c6.tar.xz |
Add grid_fineness option
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libskrift.h | 5 | ||||
-rw-r--r-- | libskrift_create_context.c | 5 |
3 files changed, 8 insertions, 4 deletions
@@ -52,7 +52,7 @@ uninstall: -rm -f -- "$(DESTDIR)$(PREFIX)/include/libskrift.h" clean: - -rm -f -- *.o *.lo *.su libskrift.a libskrift.so libskrift.so.* + -rm -f -- *.o *.lo *.su *.a *.so *.so.* .SUFFIXES: .SUFFIXES: .c .o diff --git a/libskrift.h b/libskrift.h index 5c2e937..bc09255 100644 --- a/libskrift.h +++ b/libskrift.h @@ -55,7 +55,8 @@ enum libskrift_rendering_flags { LIBSKRIFT_NO_LIGATURES = 0x0100, LIBSKRIFT_ADVANCE_TO_GRID = 0x0200, LIBSKRIFT_REGRESS_TO_GRID = 0x0400, /* Combine with LIBSKRIFT_ADVANCE_TO_GRID for closest alternative */ - LIBSKRIFT_USE_SUBPIXEL_GRID = 0x0800 + LIBSKRIFT_USE_SUBPIXEL_GRID = 0x0800, + LIBSKRIFT_VERTICAL_TEXT = 0x1000 }; struct libskrift_rendering { @@ -64,6 +65,7 @@ struct libskrift_rendering { enum libskrift_smoothing smoothing; enum libskrift_hinting hinting; enum libskrift_rendering_flags flags; + int grid_fineness; double horizontal_dpi; double vertical_dpi; double kerning; @@ -100,6 +102,7 @@ struct libskrift_saved_grapheme { .smoothing = LIBSKRIFT_GREYSCALE,\ .hinting = LIBSKRIFT_FULL,\ .flags = 0,\ + .grid_fineness = 1,\ .horizontal_dpi = (double)1920 * 254 / 5180,\ .vertical_dpi = (double)1200 * 254 / 3240,\ .kerning = 1,\ diff --git a/libskrift_create_context.c b/libskrift_create_context.c index 16c215e..9ebec24 100644 --- a/libskrift_create_context.c +++ b/libskrift_create_context.c @@ -15,7 +15,8 @@ int libskrift_create_context(LIBSKRIFT_CONTEXT **ctxp, LIBSKRIFT_FONT *font, const struct libskrift_rendering *rendering, double height) { if (rendering) { - if (HAVE_MULTIPLE_FLAGS(rendering->flags, LIBSKRIFT_CORRECT_GAMMA | LIBSKRIFT_REMOVE_GAMMA)) { + if (HAVE_MULTIPLE_FLAGS(rendering->flags, LIBSKRIFT_CORRECT_GAMMA | LIBSKRIFT_REMOVE_GAMMA) || + !rendering->grid_fineness) { errno = EINVAL; return -1; } @@ -31,7 +32,6 @@ libskrift_create_context(LIBSKRIFT_CONTEXT **ctxp, LIBSKRIFT_FONT *font, const s if (rendering) { memcpy(&(*ctxp)->rendering, rendering, sizeof(*rendering)); - COPY_ARRAY((*ctxp)->rendering, default_rendering, prestroke_transformation_rotation); COPY_ARRAY((*ctxp)->rendering, default_rendering, left_transformation); COPY_ARRAY((*ctxp)->rendering, default_rendering, right_transformation); @@ -47,6 +47,7 @@ libskrift_create_context(LIBSKRIFT_CONTEXT **ctxp, LIBSKRIFT_FONT *font, const s (*ctxp)->rendering.struct_version = LIBSKRIFT_RENDERING_STRUCT_VERSION; (*ctxp)->rendering.hinting = LIBSKRIFT_NONE; (*ctxp)->rendering.flags &= IMPLEMENTED_FLAGS; + (*ctxp)->rendering.grid_fineness = 1; (*ctxp)->rendering.kerning = 0; (*ctxp)->rendering.interletter_spacing = 0; |