aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/ports/SkFontHost_mac_coretext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp
index a48c3650b3..d6b1ecbb06 100644
--- a/src/ports/SkFontHost_mac_coretext.cpp
+++ b/src/ports/SkFontHost_mac_coretext.cpp
@@ -21,6 +21,7 @@
#ifdef SK_BUILD_FOR_IOS
#include <CoreText/CoreText.h>
#include <CoreGraphics/CoreGraphics.h>
+#include <CoreFoundation/CoreFoundation.h>
#endif
#include "SkFontHost.h"
@@ -30,6 +31,7 @@
#include "SkPaint.h"
#include "SkString.h"
#include "SkStream.h"
+#include "SkThread.h"
#include "SkTypeface_mac.h"
#include "SkUtils.h"
#include "SkTypefaceCache.h"
@@ -155,10 +157,14 @@ static CTFontRef GetFontRefFromFontID(SkFontID fontID) {
}
static SkTypeface* GetDefaultFace() {
+ static SkMutex gMutex;
+ SkAutoMutexAcquire ma(gMutex);
+
static SkTypeface* gDefaultFace;
if (NULL == gDefaultFace) {
gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkTypeface::kNormal);
+ SkTypefaceCache::Add(gDefaultFace, SkTypeface::kNormal);
}
return gDefaultFace;
}