Color bitmap support in Xft?

Clément Pit--Claudel clement.pit at gmail.com
Thu Dec 17 12:23:19 PST 2015


Hi all,

I'm looking into adding support for color emoji to Emacs. Color emoji use a new feature of OpenType fonts that allows font designers to embed full-color images in a font for certain glyphs. Fonts such as Google Noto Emoji or Apple Color Emoji thus have a table mapping certain Unicode points to raster color images. This feature is frequently used on smartphones, and was more recently added to Chrome and Firefox (both get it throught Freetype).

Freetype has support for these multicolor glyphs since version 2.5 (2013). So does FontConfig (and, apparently, Skia). However, it does not seem to be possible to use this feature through Xft.
Has there been efforts to support it?

IIUC, the required changes would involve extending case matches that look at the FT_Pixel_Mode enumeration (it gained a new member FT_PIXEL_MODE_BGRA), and passing an extra flag to Freetype. Here is the relevant documentation:

> FT_PIXEL_MODE_BGRA
> 
> An image with four 8-bit channels per pixel, representing a color
> image (such as emoticons) with alpha channel. For each pixel, the
> format is BGRA, which means, the blue channel comes first in memory.
> The color channels are pre-multiplied and in the sRGB colorspace. For
> example, full red at half-translucent opacity will be represented as
> ‘00,00,80,80’, not ‘00,00,FF,80’. See also FT_LOAD_COLOR.

> FT_LOAD_COLOR
> 
> This flag is used to request loading of color embedded-bitmap
> images. The resulting color bitmaps, if available, will have the 
> FT_PIXEL_MODE_BGRA format. When the flag is not used and color 
> bitmaps are found, they will be converted to 256-level gray bitmaps 
> transparently. Those bitmaps will be in the FT_PIXEL_MODE_GRAY 
> format

Has such an extension been discussed before? Or am I taking the wrong approach?

Clément.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20151217/ce9d4dac/attachment.sig>


More information about the xorg mailing list