2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
2018-06-14 11:32:47 +02:00
|
|
|
* ttcolr.h
|
2018-06-03 09:01:17 +02:00
|
|
|
*
|
2018-06-14 11:32:47 +02:00
|
|
|
* TrueType and OpenType colored glyph layer support (specification).
|
2018-06-03 09:01:17 +02:00
|
|
|
*
|
2022-01-11 10:54:10 +01:00
|
|
|
* Copyright (C) 2018-2022 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
2018-06-14 11:32:47 +02:00
|
|
|
* Originally written by Shao Yu Zhang <shaozhang@fb.com>.
|
2018-06-03 09:01:17 +02:00
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
[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.
2018-05-13 03:25:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef __TTCOLR_H__
|
|
|
|
#define __TTCOLR_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "ttload.h"
|
|
|
|
|
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
tt_face_load_colr( TT_Face face,
|
|
|
|
FT_Stream stream );
|
|
|
|
|
|
|
|
FT_LOCAL( void )
|
|
|
|
tt_face_free_colr( TT_Face face );
|
|
|
|
|
2018-07-02 11:41:44 +02:00
|
|
|
FT_LOCAL( FT_Bool )
|
2018-06-14 21:02:49 +02:00
|
|
|
tt_face_get_colr_layer( TT_Face face,
|
|
|
|
FT_UInt base_glyph,
|
2018-07-02 11:41:44 +02:00
|
|
|
FT_UInt *aglyph_index,
|
2018-06-14 21:02:49 +02:00
|
|
|
FT_UInt *acolor_index,
|
|
|
|
FT_LayerIterator* iterator );
|
|
|
|
|
2020-12-16 15:44:34 +01:00
|
|
|
FT_LOCAL( FT_Bool )
|
2021-01-20 12:04:50 +01:00
|
|
|
tt_face_get_colr_glyph_paint( TT_Face face,
|
|
|
|
FT_UInt base_glyph,
|
|
|
|
FT_Color_Root_Transform root_transform,
|
|
|
|
FT_OpaquePaint* paint );
|
2020-12-16 15:44:34 +01:00
|
|
|
|
2021-07-28 16:36:57 +02:00
|
|
|
FT_LOCAL( FT_Bool )
|
|
|
|
tt_face_get_color_glyph_clipbox( TT_Face face,
|
|
|
|
FT_UInt base_glyph,
|
|
|
|
FT_ClipBox* clip_box );
|
|
|
|
|
2021-06-08 18:23:16 +02:00
|
|
|
FT_LOCAL( FT_Bool )
|
2020-12-16 16:06:42 +01:00
|
|
|
tt_face_get_paint_layers( TT_Face face,
|
|
|
|
FT_LayerIterator* iterator,
|
|
|
|
FT_OpaquePaint* paint );
|
|
|
|
|
2020-12-16 16:02:22 +01:00
|
|
|
FT_LOCAL( FT_Bool )
|
|
|
|
tt_face_get_colorline_stops( TT_Face face,
|
|
|
|
FT_ColorStop* color_stop,
|
|
|
|
FT_ColorStopIterator* iterator );
|
|
|
|
|
2020-12-16 15:52:24 +01:00
|
|
|
FT_LOCAL( FT_Bool )
|
|
|
|
tt_face_get_paint( TT_Face face,
|
|
|
|
FT_OpaquePaint opaque_paint,
|
|
|
|
FT_COLR_Paint* paint );
|
|
|
|
|
[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.
2018-05-13 03:25:09 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
tt_face_colr_blend_layer( TT_Face face,
|
2018-05-30 09:34:57 +02:00
|
|
|
FT_UInt color_index,
|
[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.
2018-05-13 03:25:09 +02:00
|
|
|
FT_GlyphSlot dstSlot,
|
|
|
|
FT_GlyphSlot srcSlot );
|
|
|
|
|
|
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __TTCOLR_H__ */
|
|
|
|
|
|
|
|
/* END */
|