ref: 21c32b08d5dfb015b49f0fa245dd264aaedba4a0
parent: b4725cb716af9a052e5fd51de1b6c49360ef0106
author: Behdad Esfahbod <[email protected]>
date: Thu Jul 25 17:53:18 EDT 2013
Add FT_FACE_FLAG_COLOR and FT_HAS_COLOR. Also disambiguate Google's color bitmap tables. * include/freetype/freetype.h (FT_FACE_FLAG_COLOR, FT_HAS_COLOR): New macros. * include/freetype/internal/tttypes.h (TT_SbitTableType): Add TT_SBIT_TABLE_TYPE_CBLC. * src/sfnt/sfobjs.c (sfnt_load_face): Handle FT_FACE_FLAG_COLOR. * src/sfnt/ttsbit.c (tt_face_load_sbit, tt_face_load_strike_metrics, tt_face_load_sbit_image): Handle TT_SBIT_TABLE_TYPE_CBLC.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2013-07-25 Behdad Esfahbod <[email protected]>
+
+ Add FT_FACE_FLAG_COLOR and FT_HAS_COLOR.
+
+ Also disambiguate Google's color bitmap tables.
+
+ * include/freetype/freetype.h (FT_FACE_FLAG_COLOR, FT_HAS_COLOR):
+ New macros.
+
+ * include/freetype/internal/tttypes.h (TT_SbitTableType): Add
+ TT_SBIT_TABLE_TYPE_CBLC.
+
+ * src/sfnt/sfobjs.c (sfnt_load_face): Handle FT_FACE_FLAG_COLOR.
+
+ * src/sfnt/ttsbit.c (tt_face_load_sbit,
+ tt_face_load_strike_metrics, tt_face_load_sbit_image): Handle
+ TT_SBIT_TABLE_TYPE_CBLC.
+
2013-07-24 suzuki toshiya <[email protected]>
[sfnt] Fix for `make multi' target.
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -98,7 +98,10 @@
/* FT_FACE_FLAG_FIXED_WIDTH */
/* FT_FACE_FLAG_HORIZONTAL */
/* FT_FACE_FLAG_VERTICAL */
+ /* FT_FACE_FLAG_COLOR */
/* FT_FACE_FLAG_SFNT */
+ /* FT_FACE_FLAG_CID_KEYED */
+ /* FT_FACE_FLAG_TRICKY */
/* FT_FACE_FLAG_KERNING */
/* FT_FACE_FLAG_MULTIPLE_MASTERS */
/* FT_FACE_FLAG_GLYPH_NAMES */
@@ -1076,6 +1079,10 @@
/* Currently, there are about a dozen TrueType fonts in the list of */
/* tricky fonts; they are hard-coded in file `ttobjs.c'. */
/* */
+ /* FT_FACE_FLAG_COLOR :: */
+ /* Set if the font has color glyph tables. To access color glyphs */
+ /* use @FT_LOAD_COLOR. */
+ /* */
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
@@ -1090,6 +1097,7 @@
#define FT_FACE_FLAG_HINTER ( 1L << 11 )
#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
+#define FT_FACE_FLAG_COLOR ( 1L << 14 )
/*************************************************************************
@@ -1272,6 +1280,20 @@
*/
#define FT_IS_TRICKY( face ) \
( face->face_flags & FT_FACE_FLAG_TRICKY )
+
+
+ /*************************************************************************
+ *
+ * @macro:
+ * FT_HAS_COLOR( face )
+ *
+ * @description:
+ * A macro that returns true whenever a face object contains
+ * tables for color glyphs.
+ *
+ */
+#define FT_HAS_COLOR( face ) \
+ ( face->face_flags & FT_FACE_FLAG_COLOR )
/*************************************************************************/
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -983,8 +983,8 @@
{
TT_SBIT_TABLE_TYPE_NONE = 0,
TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */
- /* `bloc' (Apple), or */
- /* `CBLC' (Google) */
+ /* `bloc' (Apple) */
+ TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */
TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */
/* do not remove */
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -812,6 +812,10 @@
/* */
/* Compute face flags. */
/* */
+ if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_CBLC ||
+ face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX )
+ flags |= FT_FACE_FLAG_COLOR; /* color glyphs */
+
if ( has_outline == TRUE )
flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -55,14 +55,17 @@
face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE;
face->sbit_num_strikes = 0;
- /* this table is optional */
error = face->goto_table( face, TTAG_CBLC, stream, &table_size );
- if ( error )
- error = face->goto_table( face, TTAG_EBLC, stream, &table_size );
- if ( error )
- error = face->goto_table( face, TTAG_bloc, stream, &table_size );
if ( !error )
- face->sbit_table_type = TT_SBIT_TABLE_TYPE_EBLC;
+ face->sbit_table_type = TT_SBIT_TABLE_TYPE_CBLC;
+ else
+ {
+ error = face->goto_table( face, TTAG_EBLC, stream, &table_size );
+ if ( error )
+ error = face->goto_table( face, TTAG_bloc, stream, &table_size );
+ if ( !error )
+ face->sbit_table_type = TT_SBIT_TABLE_TYPE_EBLC;
+ }
if ( error )
{
@@ -83,6 +86,7 @@
switch ( (FT_UInt)face->sbit_table_type )
{
case TT_SBIT_TABLE_TYPE_EBLC:
+ case TT_SBIT_TABLE_TYPE_CBLC:
{
FT_Byte* p;
FT_Fixed version;
@@ -227,6 +231,7 @@
switch ( (FT_UInt)face->sbit_table_type )
{
case TT_SBIT_TABLE_TYPE_EBLC:
+ case TT_SBIT_TABLE_TYPE_CBLC:
{
FT_Byte* strike;
@@ -1343,6 +1348,7 @@
switch ( (FT_UInt)face->sbit_table_type )
{
case TT_SBIT_TABLE_TYPE_EBLC:
+ case TT_SBIT_TABLE_TYPE_CBLC:
{
TT_SBitDecoderRec decoder[1];