Index: src/ports/SkFontHost_FreeType.cpp |
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp |
index b98cdcdfb47405aaf8171a0bb3709822c7877ec5..9422cf99d32abc8cde9f554e6efe5cb004bd948b 100644 |
--- a/src/ports/SkFontHost_FreeType.cpp |
+++ b/src/ports/SkFontHost_FreeType.cpp |
@@ -694,6 +694,13 @@ void SkFontHost::FilterRec(SkScalerContext::Rec* rec, SkTypeface*) { |
#ifdef SK_BUILD_FOR_ANDROID |
uint32_t SkFontHost::GetUnitsPerEm(SkFontID fontID) { |
SkAutoMutexAcquire ac(gFTMutex); |
+ FT_Library libInit = NULL; |
+ if (gFTCount == 0) { |
+ if (!InitFreetype()) |
+ sk_throw(); |
+ libInit = gFTLibrary; |
+ } |
+ SkAutoTCallIProc<struct FT_LibraryRec_, FT_Done_FreeType> ftLib(libInit); |
SkFaceRec *rec = ref_ft_face(fontID); |
uint16_t unitsPerEm = 0; |