aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Seigo Nonaka <nona@google.com>2016-12-05 02:41:53 +0900
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-05 22:39:40 +0000
commit52ab2f5df17c953dc673954e427fc1aa1a5fe48e (patch)
tree38cabd81e4dc45f7ba64d4ff4214be5656f6cb07
parent11970e56c10b49ad06adbe9e835d32c00a63dd7d (diff)
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>
-rw-r--r--src/ports/SkFontHost_FreeType.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 0a4e63688d..15bc14d213 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 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
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;