Fix bug 6888377: crash in GetUnitsPerEm on locale change

The underlying problem is that no SkScalerContext objects existed at the
time shapeFontRun is called immediately after a locale change from en to
ja (apparently the dumping of the cache caused all these to be
deallocated), so gFTLibrary was null (and the call tio ref_ft_face
assumes that it's initialized).

There's a pattern for calls which might not necessarily be called from a
scaler context (GetAdvancedTypefaceMetrics is one such), to explicitly
check for an uninitialized library, and create one for the length of the
call if so. This patch changes GetUnitsPerEm to follow this pattern.

Change-Id: I19a4b6fa49fad0aeacc04bf971101aacca6bc94f
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index da00d51..eb05959 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -685,6 +685,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;