ref: 778a7e6a36912303d9cb8b16b7aceacf3572d325
parent: 01705395b08167b654a24f26673ee6e75a84f2be
author: Behdad Esfahbod <[email protected]>
date: Fri Jul 19 10:28:28 EDT 2013
[sfnt] `sbix' fix-ups. * src/sfnt/sfobjs.c (sfnt_load_face): Apple's `sbix' color bitmaps are rendered scaled and then the `glyf' outline rendered on top. We don't support that yet, so just ignore the `glyf' outline and advertise it as a bitmap-only font. * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) [TT_SBIT_TABLE_TYPE_SBIX]: Return metrics in 26.6 units. (tt_face_load_sbix_image): Typo.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2013-07-18 Behdad Esfahbod <[email protected]>
+ [sfnt] `sbix' fix-ups.
+
+ * src/sfnt/sfobjs.c (sfnt_load_face): Apple's `sbix' color bitmaps
+ are rendered scaled and then the `glyf' outline rendered on top. We
+ don't support that yet, so just ignore the `glyf' outline and
+ advertise it as a bitmap-only font.
+
+ * src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
+ [TT_SBIT_TABLE_TYPE_SBIX]: Return metrics in 26.6 units.
+ (tt_face_load_sbix_image): Typo.
+
+2013-07-18 Behdad Esfahbod <[email protected]>
+
[sfnt] Add support for Apple's `sbix' color bitmap table.
* include/freetype/internal/tttypes.h (TT_SBit_MetricsRec): Widen
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -555,6 +555,7 @@
#endif
FT_Bool has_outline;
FT_Bool is_apple_sbit;
+ FT_Bool is_apple_sbix;
FT_Bool ignore_preferred_family = FALSE;
FT_Bool ignore_preferred_subfamily = FALSE;
@@ -608,7 +609,15 @@
#endif
is_apple_sbit = 0;
+ is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 );
+ /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf'
+ * outline rendered on top. We don't support that yet, so just ignore
+ * the 'glyf' outline and advertise it as a bitmap-only font. */
+ if ( is_apple_sbix )
+ has_outline = FALSE;
+
+
/* if this font doesn't contain outlines, we try to load */
/* a `bhed' table */
if ( !has_outline && sfnt->load_bhed )
@@ -619,7 +628,7 @@
/* load the font header (`head' table) if this isn't an Apple */
/* sbit font file */
- if ( !is_apple_sbit )
+ if ( !is_apple_sbit || is_apple_sbix )
{
LOAD_( head );
if ( error )
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -286,12 +286,12 @@
metrics->x_ppem = ppem;
metrics->y_ppem = ppem;
- metrics->ascender = ppem * hori->Ascender / upem;
- metrics->descender = ppem * hori->Descender / upem;
+ metrics->ascender = ppem * hori->Ascender * 64 / upem;
+ metrics->descender = ppem * hori->Descender * 64 / upem;
metrics->height = ppem * ( hori->Ascender -
hori->Descender +
- hori->Line_Gap ) / upem;
- metrics->max_advance = ppem * hori->advance_Width_Max / upem;
+ hori->Line_Gap ) * 64 / upem;
+ metrics->max_advance = ppem * hori->advance_Width_Max * 64 / upem;
return error;
}
@@ -1322,7 +1322,7 @@
metrics->horiBearingX = originOffsetX;
metrics->horiBearingY = -originOffsetY + metrics->height;
metrics->horiAdvance = aadvance * face->root.size->metrics.x_ppem /
- face->root.units_per_EM;
+ face->header.Units_Per_EM;
}
return error;