Use FT_LOAD_BITMAP_METRICS_ONLY flag
FT_LOAD_BITMAP_METRICS_ONLY flag was introduced for retrieving font
metrics without decoding or allocating bitmaps.
BUG=skia:
Change-Id: I901531501111f24d8b670305379e04c0bc688e6f
Reviewed-on: https://skia-review.googlesource.com/5580
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 0a4e636..15bc14d 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -53,6 +53,12 @@
# define FT_PIXEL_MODE_BGRA 7
#endif
+// FT_LOAD_BITMAP_METRICS_ONLY was introduced in FreeType 2.7.1
+// The following may be removed once FreeType 2.7.1 is required to build.
+#ifndef FT_LOAD_BITMAP_METRICS_ONLY
+# define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 )
+#endif
+
//#define ENABLE_GLYPH_SPEW // for tracing calls
//#define DUMP_STRIKE_CREATION
//#define SK_FONTHOST_FREETYPE_USE_NORMAL_LCD_FILTER
@@ -1084,7 +1090,8 @@
return;
}
- err = FT_Load_Glyph( fFace, glyph->getGlyphID(), fLoadGlyphFlags );
+ err = FT_Load_Glyph( fFace, glyph->getGlyphID(),
+ fLoadGlyphFlags | FT_LOAD_BITMAP_METRICS_ONLY );
if (err != 0) {
glyph->zeroMetrics();
return;