[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
diff --git a/ChangeLog b/ChangeLog
index 4fa89e6..f525b2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2013-07-18 Behdad Esfahbod <behdad@google.com>
+ [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 <behdad@google.com>
+
[sfnt] Add support for Apple's `sbix' color bitmap table.
* include/freetype/internal/tttypes.h (TT_SBit_MetricsRec): Widen
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index f975e71..f94518a 100644
--- 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,6 +609,14 @@
#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 */
@@ -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 )
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 2fc0ef1..c147251 100644
--- 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;