freetype/src/sfnt
Behdad Esfahbod 760d342d37 Add support for color embedded bitmaps (eg. color emoji).
A new load flag, FT_LOAD_COLOR, makes FreeType load color
embedded-bitmaps, following this draft specification

  https://color-emoji.googlecode.com/git/specification/v1.html

which defines two new SFNT tables, `CBDT' and `CBLC' (named and
modeled after `EBDT' and `EBLC', respectively).  The color bitmaps
are stored in the new FT_PIXEL_MODE_BGRA format to represent BGRA
pre-multiplied sRGB images.  If PNG support is available, PNG color
images as defined in the same proposed specification are supported
also.

Note that color bitmaps are converted to grayscale if client didn't
ask for color.

* builds/unix/configure.raw: Search for libpng.
Add `--without-png' option.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_PNG): New macro.

* include/freetype/freetype.h (FT_LOAD_COLOR): New load flag.

* include/freetype/ftimage.h (FT_Pixel_Mode): Add
`FT_PIXEL_MODE_BGRA'.

* include/freetype/tttags.h (TTAG_CBDT, TTAG_CBLC): New tags.

* src/base/ftbitmap.c (FT_Bitmap_Embolden): Updated.
(ft_gray_for_premultiplied_srgb_bgra): New function.
(FT_Bitmap_Convert): Handle FT_PIXEL_MODE_BGRA.

* src/sfnt/pngshim.c, src/sfnt/pngshim.h: New files.

* src/sfnt/sfnt.c: Include `pngshim.c'.

* src/sfnt/ttsbit.c: Include FT_BITMAP_H and `pngshim.h'
(tt_face_load_eblc): Load `CBLC'.
(tt_sbit_decoder_init): Load `CBDT'.
(tt_sbit_decoder_alloc_bitmap): Pass load flags to select between
color and grayscale bitmaps.
Set `num_grays'.  This is used by `ftview' to choose the blending
algorithm.
(tt_sbit_decoder_load_byte_aligned,
tt_sbit_decoder_load_bit_aligned, tt_sbit_decoder_load_compound,
tt_sbit_decoder_load_image): Pass load flag.
s/write/pwrite/.
Don't call `tt_sbit_decoder_alloc_bitmap'.
Updated.
(tt_sbit_decoder_load_png) [FT_CONFIG_OPTION_USE_PNG]: New function.
(tt_sbit_decoder_load_bitmap): Pass load flag.
Handle new glyph formats 17, 18, and 19.
Call `tt_sbit_decoder_alloc_bitmap'.
Flatten color bitmaps if necessary.
(tt_face_load_sbit_image): Updated.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `pngshim.c'.

* docs/CHANGES: Updated.
2013-05-29 11:36:18 +02:00
..
Jamfile Position Independent Code (PIC) support in sfnt driver. 2009-04-05 18:08:32 +03:00
module.mk FT_USE_MODULE declares things as: 2008-12-21 10:29:30 +00:00
pngshim.c Add support for color embedded bitmaps (eg. color emoji). 2013-05-29 11:36:18 +02:00
pngshim.h Add support for color embedded bitmaps (eg. color emoji). 2013-05-29 11:36:18 +02:00
rules.mk Add support for color embedded bitmaps (eg. color emoji). 2013-05-29 11:36:18 +02:00
sfdriver.c */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00
sfdriver.h Position Independent Code (PIC) support in sfnt driver. 2009-04-05 18:08:32 +03:00
sferrors.h Remove `FT_KEEP_ERR_PREFIX'. 2013-03-12 11:42:20 +01:00
sfnt.c Add support for color embedded bitmaps (eg. color emoji). 2013-05-29 11:36:18 +02:00
sfntpic.c Whitespace. 2013-03-17 08:14:46 +01:00
sfntpic.h Whitespace. 2013-03-17 08:14:46 +01:00
sfobjs.c */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00
sfobjs.h * massive re-formatting changes to many, many source files. I don't 2002-08-27 20:20:29 +00:00
ttbdf.c */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate. 2013-03-14 17:50:49 +01:00
ttbdf.h Convert to Unix line endings. 2006-03-01 11:31:08 +00:00
ttcmap.c */*: Use FT_Err_Ok only. 2013-03-14 11:21:17 +01:00
ttcmap.h [sfnt] Formatting. 2012-08-27 05:48:23 +02:00
ttcmapc.h [sfnt] Formatting. 2012-08-27 05:48:23 +02:00
ttkern.c */*: Use `FT_THROW'. 2013-03-14 10:27:35 +01:00
ttkern.h formatting, minor doc fixes, copyright years 2007-01-05 09:03:31 +00:00
ttload.c */*: Use FT_Err_Ok only. 2013-03-14 11:21:17 +01:00
ttload.h * include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in 2006-02-15 06:05:52 +00:00
ttmtx.c */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00
ttmtx.h Clean up the SFNT_Interface. In this final pass, `load_hmtx' is 2006-02-14 07:25:57 +00:00
ttpost.c */*: Use FT_Err_Ok only. 2013-03-14 11:21:17 +01:00
ttpost.h * massive re-formatting changes to many, many source files. I don't 2002-08-27 20:20:29 +00:00
ttsbit.c Add support for color embedded bitmaps (eg. color emoji). 2013-05-29 11:36:18 +02:00
ttsbit.h */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00