am fbb38cd1: Merge "Fix bug 6888377: crash in GetUnitsPerEm on locale change" into jb-mr1-dev

* commit 'fbb38cd17727043aa04957aa5edd7c9fec4d076a':
  Fix bug 6888377: crash in GetUnitsPerEm on locale change
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 6aa2120..d77ebb9 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -695,6 +695,13 @@
 #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;