summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorShao Yu Zhang <shaozhang@fb.com>2018-05-13 03:25:09 +0200
committerWerner Lemberg <wl@gnu.org>2018-05-13 03:25:09 +0200
commitf04d81751ac68b23c89da2edd31c43fd9fc5c75c (patch)
treea2b8a22fb749ed5905f5643ef85c62b4b3d646cf /devel
parent84eebf48021ab76c1c628bb7451b712f701e4518 (diff)
downloadfreetype2-f04d81751ac68b23c89da2edd31c43fd9fc5c75c.tar.gz
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical application are color emojis that can be scaled to any size. If the color palette does not exist or is invalid, the rendering step rasterizes the outline instead. The current implementation assumes that the foreground is black. Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS. There are still some issues with metrics; additionally, an API to fetch color layers is missing. * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_COLOR_LAYERS): New macro. * include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec, FT_Colr_InternalRec): New structures. (FT_Slot_InternalRec): Add `color_layers' field. * include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func, TT_Blend_Colr_Func): New function types. (SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer', and `colr_blend' fields. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `colr_and_cpal' field. * include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New macros. * src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files. * src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal): Handle glyph color layers. * src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttcolr.c'. * src/sfnt/sfdriver.c: Include `ttcolr.h'. (PUT_COLOR_LAYERS): New macro. Update call to `FT_DEFINE_SFNT_INTERFACE'. * src/sfnt/sfnt.c: Include `ttcolr.c'. * src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables. (sfnt_done_face): Updated. * src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
Diffstat (limited to 'devel')
-rw-r--r--devel/ftoption.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 84933a0c7..2bc2a76eb 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -487,6 +487,15 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
+ /* Define TT_CONFIG_OPTION_COLOR_LAYERS if you want to support coloured */
+ /* outlines (from the COLR/CPAL tables) in all formats using the SFNT */
+ /* module (namely TrueType & OpenType). */
+ /* */
+#define TT_CONFIG_OPTION_COLOR_LAYERS
+
+
+ /*************************************************************************/
+ /* */
/* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
/* load and enumerate the glyph Postscript names in a TrueType or */
/* OpenType file. */