OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkDataTable.h" | 8 #include "SkDataTable.h" |
9 #include "SkFixed.h" | 9 #include "SkFixed.h" |
10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 * interesting if the values go against convention. | 55 * interesting if the values go against convention. |
56 * | 56 * |
57 * Somewhat like DirectWrite, FontConfig supports synthetics through FC_EMBOLDE
N and FC_MATRIX. | 57 * Somewhat like DirectWrite, FontConfig supports synthetics through FC_EMBOLDE
N and FC_MATRIX. |
58 * Like all synthetic information, such information must be passed with the fon
t data. | 58 * Like all synthetic information, such information must be passed with the fon
t data. |
59 */ | 59 */ |
60 | 60 |
61 namespace { | 61 namespace { |
62 | 62 |
63 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob
al mutex. | 63 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob
al mutex. |
64 // See https://bug.skia.org/1497 for background. | 64 // See https://bug.skia.org/1497 for background. |
65 SK_DECLARE_STATIC_MUTEX(gFCMutex); | 65 static SkMutex gFCMutex; |
66 | 66 |
67 #ifdef SK_DEBUG | 67 #ifdef SK_DEBUG |
68 void* CreateThreadFcLocked() { return new bool(false); } | 68 void* CreateThreadFcLocked() { return new bool(false); } |
69 void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); } | 69 void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); } |
70 # define THREAD_FC_LOCKED \ | 70 # define THREAD_FC_LOCKED \ |
71 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked
)) | 71 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked
)) |
72 #endif | 72 #endif |
73 | 73 |
74 struct FCLocker { | 74 struct FCLocker { |
75 // Assume FcGetVersion() has always been thread safe. | 75 // Assume FcGetVersion() has always been thread safe. |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 return typeface.release(); | 933 return typeface.release(); |
934 } | 934 } |
935 | 935 |
936 return this->matchFamilyStyle(nullptr, style); | 936 return this->matchFamilyStyle(nullptr, style); |
937 } | 937 } |
938 }; | 938 }; |
939 | 939 |
940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { | 940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { |
941 return new SkFontMgr_fontconfig(fc); | 941 return new SkFontMgr_fontconfig(fc); |
942 } | 942 } |
OLD | NEW |