Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: src/ports/SkFontHost_FreeType.cpp

Issue 2021923002: [Not for commit] Inject TRACE_EVENT to SkFontHost_FreeType.cpp Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkDescriptor.h" 12 #include "SkDescriptor.h"
13 #include "SkFDot6.h" 13 #include "SkFDot6.h"
14 #include "SkFontDescriptor.h" 14 #include "SkFontDescriptor.h"
15 #include "SkFontHost_FreeType_common.h" 15 #include "SkFontHost_FreeType_common.h"
16 #include "SkGlyph.h" 16 #include "SkGlyph.h"
17 #include "SkMask.h" 17 #include "SkMask.h"
18 #include "SkMaskGamma.h" 18 #include "SkMaskGamma.h"
19 #include "SkMatrix22.h" 19 #include "SkMatrix22.h"
20 #include "SkMutex.h" 20 #include "SkMutex.h"
21 #include "SkOTUtils.h" 21 #include "SkOTUtils.h"
22 #include "SkPath.h" 22 #include "SkPath.h"
23 #include "SkScalerContext.h" 23 #include "SkScalerContext.h"
24 #include "SkStream.h" 24 #include "SkStream.h"
25 #include "SkString.h" 25 #include "SkString.h"
26 #include "SkTemplates.h" 26 #include "SkTemplates.h"
27 #include "SkTypes.h" 27 #include "SkTypes.h"
28 #include <memory> 28 #include <memory>
29 29
30 #include "base/trace_event/trace_event.h"
31
30 #if defined(SK_CAN_USE_DLOPEN) 32 #if defined(SK_CAN_USE_DLOPEN)
31 #include <dlfcn.h> 33 #include <dlfcn.h>
32 #endif 34 #endif
33 #include <ft2build.h> 35 #include <ft2build.h>
34 #include FT_ADVANCES_H 36 #include FT_ADVANCES_H
35 #include FT_BITMAP_H 37 #include FT_BITMAP_H
36 #include FT_FREETYPE_H 38 #include FT_FREETYPE_H
37 #include FT_LCD_FILTER_H 39 #include FT_LCD_FILTER_H
38 #include FT_MODULE_H 40 #include FT_MODULE_H
39 #include FT_MULTIPLE_MASTERS_H 41 #include FT_MULTIPLE_MASTERS_H
(...skipping 11 matching lines...) Expand all
51 # define FT_LOAD_COLOR ( 1L << 20 ) 53 # define FT_LOAD_COLOR ( 1L << 20 )
52 # define FT_PIXEL_MODE_BGRA 7 54 # define FT_PIXEL_MODE_BGRA 7
53 #endif 55 #endif
54 56
55 //#define ENABLE_GLYPH_SPEW // for tracing calls 57 //#define ENABLE_GLYPH_SPEW // for tracing calls
56 //#define DUMP_STRIKE_CREATION 58 //#define DUMP_STRIKE_CREATION
57 //#define SK_FONTHOST_FREETYPE_USE_NORMAL_LCD_FILTER 59 //#define SK_FONTHOST_FREETYPE_USE_NORMAL_LCD_FILTER
58 //#define SK_FONTHOST_FREETYPE_RUNTIME_VERSION 60 //#define SK_FONTHOST_FREETYPE_RUNTIME_VERSION
59 //#define SK_GAMMA_APPLY_TO_A8 61 //#define SK_GAMMA_APPLY_TO_A8
60 62
63 class SkTracedAutoMutexAcquire : SkNoncopyable {
64 public:
65 explicit SkTracedAutoMutexAcquire(SkBaseMutex& mutex) : fMutex(&mutex) {
66 SkASSERT(fMutex != nullptr);
67 {
68 TRACE_EVENT1("tzik", __PRETTY_FUNCTION__, "line", __LINE__);
69 mutex.acquire();
70 }
71 TRACE_EVENT_BEGIN0("tzik", "locked");
72 }
73
74 explicit SkTracedAutoMutexAcquire(SkBaseMutex* mutex) : fMutex(mutex) {
75 if (mutex) {
76 {
77 TRACE_EVENT1("tzik", __PRETTY_FUNCTION__, "line", __LINE__);
78 mutex->acquire();
79 }
80 TRACE_EVENT_BEGIN0("tzik", "locked");
81 }
82 }
83
84 /** If the mutex has not been released, release it now. */
85 ~SkTracedAutoMutexAcquire() {
86 if (fMutex) {
87 TRACE_EVENT_END0("tzik", "locked");
88 fMutex->release();
89 }
90 }
91
92 /** If the mutex has not been released, release it now. */
93 void release() {
94 if (fMutex) {
95 fMutex->release();
96 fMutex = nullptr;
97 }
98 }
99
100 /** Assert that we're holding the mutex. */
101 void assertHeld() {
102 SkASSERT(fMutex);
103 fMutex->assertHeld();
104 }
105
106 private:
107 SkBaseMutex* fMutex;
108 };
109
110
61 static bool isLCD(const SkScalerContext::Rec& rec) { 111 static bool isLCD(const SkScalerContext::Rec& rec) {
62 return SkMask::kLCD16_Format == rec.fMaskFormat; 112 return SkMask::kLCD16_Format == rec.fMaskFormat;
63 } 113 }
64 114
65 ////////////////////////////////////////////////////////////////////////// 115 //////////////////////////////////////////////////////////////////////////
66 116
67 extern "C" { 117 extern "C" {
68 static void* sk_ft_alloc(FT_Memory, long size) { 118 static void* sk_ft_alloc(FT_Memory, long size) {
69 return sk_malloc_throw(size); 119 return sk_malloc_throw(size);
70 } 120 }
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 //Cap the requested size as larger sizes give bogus values. 730 //Cap the requested size as larger sizes give bogus values.
681 //Remove when http://code.google.com/p/skia/issues/detail?id=554 is fixed. 731 //Remove when http://code.google.com/p/skia/issues/detail?id=554 is fixed.
682 //Note that this also currently only protects against large text size reques ts, 732 //Note that this also currently only protects against large text size reques ts,
683 //the total matrix is not taken into account here. 733 //the total matrix is not taken into account here.
684 if (rec->fTextSize > SkIntToScalar(1 << 14)) { 734 if (rec->fTextSize > SkIntToScalar(1 << 14)) {
685 rec->fTextSize = SkIntToScalar(1 << 14); 735 rec->fTextSize = SkIntToScalar(1 << 14);
686 } 736 }
687 737
688 if (isLCD(*rec)) { 738 if (isLCD(*rec)) {
689 // TODO: re-work so that FreeType is set-up and selected by the SkFontMg r. 739 // TODO: re-work so that FreeType is set-up and selected by the SkFontMg r.
690 SkAutoMutexAcquire ama(gFTMutex); 740 SkTracedAutoMutexAcquire ama(gFTMutex);
691 ref_ft_library(); 741 ref_ft_library();
692 if (!gFTLibrary->isLCDSupported()) { 742 if (!gFTLibrary->isLCDSupported()) {
693 // If the runtime Freetype library doesn't support LCD, disable it h ere. 743 // If the runtime Freetype library doesn't support LCD, disable it h ere.
694 rec->fMaskFormat = SkMask::kA8_Format; 744 rec->fMaskFormat = SkMask::kA8_Format;
695 } 745 }
696 unref_ft_library(); 746 unref_ft_library();
697 } 747 }
698 748
699 SkPaint::Hinting h = rec->getHinting(); 749 SkPaint::Hinting h = rec->getHinting();
700 if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) { 750 if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 } 842 }
793 843
794 SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, 844 SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface,
795 const SkScalerContextEffects& effects, 845 const SkScalerContextEffects& effects,
796 const SkDescriptor* desc) 846 const SkDescriptor* desc)
797 : SkScalerContext_FreeType_Base(typeface, effects, desc) 847 : SkScalerContext_FreeType_Base(typeface, effects, desc)
798 , fFace(nullptr) 848 , fFace(nullptr)
799 , fFTSize(nullptr) 849 , fFTSize(nullptr)
800 , fStrikeIndex(-1) 850 , fStrikeIndex(-1)
801 { 851 {
802 SkAutoMutexAcquire ac(gFTMutex); 852 SkTracedAutoMutexAcquire ac(gFTMutex);
803 853
804 if (!ref_ft_library()) { 854 if (!ref_ft_library()) {
805 sk_throw(); 855 sk_throw();
806 } 856 }
807 857
808 // load the font file 858 // load the font file
809 using UnrefFTFace = SkFunctionWrapper<void, skstd::remove_pointer_t<FT_Face> , unref_ft_face>; 859 using UnrefFTFace = SkFunctionWrapper<void, skstd::remove_pointer_t<FT_Face> , unref_ft_face>;
810 std::unique_ptr<skstd::remove_pointer_t<FT_Face>, UnrefFTFace> ftFace(ref_ft _face(typeface)); 860 std::unique_ptr<skstd::remove_pointer_t<FT_Face>, UnrefFTFace> ftFace(ref_ft _face(typeface));
811 if (nullptr == ftFace) { 861 if (nullptr == ftFace) {
812 SkDEBUGF(("Could not create FT_Face.\n")); 862 SkDEBUGF(("Could not create FT_Face.\n"));
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 SkDEBUGF(("unknown kind of font \"%s\" size %f?\n", 996 SkDEBUGF(("unknown kind of font \"%s\" size %f?\n",
947 fFace->family_name, SkFDot6ToScalar(fScaleY))); 997 fFace->family_name, SkFDot6ToScalar(fScaleY)));
948 } 998 }
949 999
950 fFTSize = ftSize.release(); 1000 fFTSize = ftSize.release();
951 fFace = ftFace.release(); 1001 fFace = ftFace.release();
952 fDoLinearMetrics = linearMetrics; 1002 fDoLinearMetrics = linearMetrics;
953 } 1003 }
954 1004
955 SkScalerContext_FreeType::~SkScalerContext_FreeType() { 1005 SkScalerContext_FreeType::~SkScalerContext_FreeType() {
956 SkAutoMutexAcquire ac(gFTMutex); 1006 SkTracedAutoMutexAcquire ac(gFTMutex);
957 1007
958 if (fFTSize != nullptr) { 1008 if (fFTSize != nullptr) {
959 FT_Done_Size(fFTSize); 1009 FT_Done_Size(fFTSize);
960 } 1010 }
961 1011
962 if (fFace != nullptr) { 1012 if (fFace != nullptr) {
963 unref_ft_face(fFace); 1013 unref_ft_face(fFace);
964 } 1014 }
965 1015
966 unref_ft_library(); 1016 unref_ft_library();
(...skipping 16 matching lines...) Expand all
983 // I get random italics from some other fFTSize) 1033 // I get random italics from some other fFTSize)
984 FT_Set_Transform(fFace, &fMatrix22, nullptr); 1034 FT_Set_Transform(fFace, &fMatrix22, nullptr);
985 return 0; 1035 return 0;
986 } 1036 }
987 1037
988 unsigned SkScalerContext_FreeType::generateGlyphCount() { 1038 unsigned SkScalerContext_FreeType::generateGlyphCount() {
989 return fFace->num_glyphs; 1039 return fFace->num_glyphs;
990 } 1040 }
991 1041
992 uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) { 1042 uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) {
993 SkAutoMutexAcquire ac(gFTMutex); 1043 SkTracedAutoMutexAcquire ac(gFTMutex);
994 return SkToU16(FT_Get_Char_Index( fFace, uni )); 1044 return SkToU16(FT_Get_Char_Index( fFace, uni ));
995 } 1045 }
996 1046
997 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) { 1047 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) {
998 SkAutoMutexAcquire ac(gFTMutex); 1048 SkTracedAutoMutexAcquire ac(gFTMutex);
999 // iterate through each cmap entry, looking for matching glyph indices 1049 // iterate through each cmap entry, looking for matching glyph indices
1000 FT_UInt glyphIndex; 1050 FT_UInt glyphIndex;
1001 SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex ); 1051 SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex );
1002 1052
1003 while (glyphIndex != 0) { 1053 while (glyphIndex != 0) {
1004 if (glyphIndex == glyph) { 1054 if (glyphIndex == glyph) {
1005 return charCode; 1055 return charCode;
1006 } 1056 }
1007 charCode = FT_Get_Next_Char( fFace, charCode, &glyphIndex ); 1057 charCode = FT_Get_Next_Char( fFace, charCode, &glyphIndex );
1008 } 1058 }
1009 1059
1010 return 0; 1060 return 0;
1011 } 1061 }
1012 1062
1013 static SkScalar SkFT_FixedToScalar(FT_Fixed x) { 1063 static SkScalar SkFT_FixedToScalar(FT_Fixed x) {
1014 return SkFixedToScalar(x); 1064 return SkFixedToScalar(x);
1015 } 1065 }
1016 1066
1017 void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) { 1067 void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) {
1018 /* unhinted and light hinted text have linearly scaled advances 1068 /* unhinted and light hinted text have linearly scaled advances
1019 * which are very cheap to compute with some font formats... 1069 * which are very cheap to compute with some font formats...
1020 */ 1070 */
1021 if (fDoLinearMetrics) { 1071 if (fDoLinearMetrics) {
1022 SkAutoMutexAcquire ac(gFTMutex); 1072 SkTracedAutoMutexAcquire ac(gFTMutex);
1023 1073
1024 if (this->setupSize()) { 1074 if (this->setupSize()) {
1025 glyph->zeroMetrics(); 1075 glyph->zeroMetrics();
1026 return; 1076 return;
1027 } 1077 }
1028 1078
1029 FT_Error error; 1079 FT_Error error;
1030 FT_Fixed advance; 1080 FT_Fixed advance;
1031 1081
1032 error = FT_Get_Advance( fFace, glyph->getGlyphID(), 1082 error = FT_Get_Advance( fFace, glyph->getGlyphID(),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 glyph.fHeight *= scale; 1166 glyph.fHeight *= scale;
1117 glyph.fTop *= scale; 1167 glyph.fTop *= scale;
1118 glyph.fLeft *= scale; 1168 glyph.fLeft *= scale;
1119 1169
1120 float floatScale = SkScalarToFloat(scale); 1170 float floatScale = SkScalarToFloat(scale);
1121 glyph.fAdvanceX *= floatScale; 1171 glyph.fAdvanceX *= floatScale;
1122 glyph.fAdvanceY *= floatScale; 1172 glyph.fAdvanceY *= floatScale;
1123 } 1173 }
1124 1174
1125 void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) { 1175 void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
1126 SkAutoMutexAcquire ac(gFTMutex); 1176 SkTracedAutoMutexAcquire ac(gFTMutex);
1127 1177
1128 glyph->fRsbDelta = 0; 1178 glyph->fRsbDelta = 0;
1129 glyph->fLsbDelta = 0; 1179 glyph->fLsbDelta = 0;
1130 1180
1131 FT_Error err; 1181 FT_Error err;
1132 1182
1133 if (this->setupSize()) { 1183 if (this->setupSize()) {
1134 glyph->zeroMetrics(); 1184 glyph->zeroMetrics();
1135 return; 1185 return;
1136 } 1186 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 SkDEBUGF(("FT_Set_Char_Size(this:%p sx:%x sy:%x ", this, fScaleX, fScaleY)); 1274 SkDEBUGF(("FT_Set_Char_Size(this:%p sx:%x sy:%x ", this, fScaleX, fScaleY));
1225 SkDEBUGF(("Metrics(glyph:%d flags:0x%x) w:%d\n", glyph->getGlyphID(), fLoadG lyphFlags, glyph->fWidth)); 1275 SkDEBUGF(("Metrics(glyph:%d flags:0x%x) w:%d\n", glyph->getGlyphID(), fLoadG lyphFlags, glyph->fWidth));
1226 #endif 1276 #endif
1227 } 1277 }
1228 1278
1229 static void clear_glyph_image(const SkGlyph& glyph) { 1279 static void clear_glyph_image(const SkGlyph& glyph) {
1230 sk_bzero(glyph.fImage, glyph.rowBytes() * glyph.fHeight); 1280 sk_bzero(glyph.fImage, glyph.rowBytes() * glyph.fHeight);
1231 } 1281 }
1232 1282
1233 void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) { 1283 void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
1234 SkAutoMutexAcquire ac(gFTMutex); 1284 TRACE_EVENT1("tzik", __PRETTY_FUNCTION__, "line", __LINE__);
1285 SkTracedAutoMutexAcquire ac(gFTMutex);
1235 1286
1236 if (this->setupSize()) { 1287 if (this->setupSize()) {
1237 clear_glyph_image(glyph); 1288 clear_glyph_image(glyph);
1238 return; 1289 return;
1239 } 1290 }
1240 1291
1241 FT_Error err = FT_Load_Glyph(fFace, glyph.getGlyphID(), fLoadGlyphFlags); 1292 FT_Error err = FT_Load_Glyph(fFace, glyph.getGlyphID(), fLoadGlyphFlags);
1242 if (err != 0) { 1293 if (err != 0) {
1243 SkDEBUGF(("SkScalerContext_FreeType::generateImage: FT_Load_Glyph(glyph: %d width:%d height:%d rb:%d flags:%d) returned 0x%x\n", 1294 SkDEBUGF(("SkScalerContext_FreeType::generateImage: FT_Load_Glyph(glyph: %d width:%d height:%d rb:%d flags:%d) returned 0x%x\n",
1244 glyph.getGlyphID(), glyph.fWidth, glyph.fHeight, glyph.rowByte s(), fLoadGlyphFlags, err)); 1295 glyph.getGlyphID(), glyph.fWidth, glyph.fHeight, glyph.rowByte s(), fLoadGlyphFlags, err));
1245 clear_glyph_image(glyph); 1296 clear_glyph_image(glyph);
1246 return; 1297 return;
1247 } 1298 }
1248 1299
1249 emboldenIfNeeded(fFace, fFace->glyph); 1300 emboldenIfNeeded(fFace, fFace->glyph);
1250 generateGlyphImage(fFace, glyph); 1301 generateGlyphImage(fFace, glyph);
1251 } 1302 }
1252 1303
1253 1304
1254 void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph, SkPath* path) { 1305 void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph, SkPath* path) {
1255 SkAutoMutexAcquire ac(gFTMutex); 1306 SkTracedAutoMutexAcquire ac(gFTMutex);
1256 1307
1257 SkASSERT(path); 1308 SkASSERT(path);
1258 1309
1259 if (this->setupSize()) { 1310 if (this->setupSize()) {
1260 path->reset(); 1311 path->reset();
1261 return; 1312 return;
1262 } 1313 }
1263 1314
1264 uint32_t flags = fLoadGlyphFlags; 1315 uint32_t flags = fLoadGlyphFlags;
1265 flags |= FT_LOAD_NO_BITMAP; // ignore embedded bitmaps so we're sure to get the outline 1316 flags |= FT_LOAD_NO_BITMAP; // ignore embedded bitmaps so we're sure to get the outline
(...skipping 20 matching lines...) Expand all
1286 FT_Vector_Transform(&vector, &fMatrix22); 1337 FT_Vector_Transform(&vector, &fMatrix22);
1287 path->offset(SkFDot6ToScalar(vector.x), -SkFDot6ToScalar(vector.y)); 1338 path->offset(SkFDot6ToScalar(vector.x), -SkFDot6ToScalar(vector.y));
1288 } 1339 }
1289 } 1340 }
1290 1341
1291 void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics ) { 1342 void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics ) {
1292 if (nullptr == metrics) { 1343 if (nullptr == metrics) {
1293 return; 1344 return;
1294 } 1345 }
1295 1346
1296 SkAutoMutexAcquire ac(gFTMutex); 1347 SkTracedAutoMutexAcquire ac(gFTMutex);
1297 1348
1298 if (this->setupSize()) { 1349 if (this->setupSize()) {
1299 sk_bzero(metrics, sizeof(*metrics)); 1350 sk_bzero(metrics, sizeof(*metrics));
1300 return; 1351 return;
1301 } 1352 }
1302 1353
1303 FT_Face face = fFace; 1354 FT_Face face = fFace;
1304 SkScalar scaleX = fScale.x(); 1355 SkScalar scaleX = fScale.x();
1305 SkScalar scaleY = fScale.y(); 1356 SkScalar scaleY = fScale.y();
1306 SkScalar mxy = fMatrix22Scalar.getSkewX() * scaleY; 1357 SkScalar mxy = fMatrix22Scalar.getSkewX() * scaleY;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 } 1692 }
1642 1693
1643 FT_Face face; 1694 FT_Face face;
1644 if (FT_Open_Face(fLibrary, &args, ttcIndex, &face)) { 1695 if (FT_Open_Face(fLibrary, &args, ttcIndex, &face)) {
1645 return nullptr; 1696 return nullptr;
1646 } 1697 }
1647 return face; 1698 return face;
1648 } 1699 }
1649 1700
1650 bool SkTypeface_FreeType::Scanner::recognizedFont(SkStream* stream, int* numFace s) const { 1701 bool SkTypeface_FreeType::Scanner::recognizedFont(SkStream* stream, int* numFace s) const {
1651 SkAutoMutexAcquire libraryLock(fLibraryMutex); 1702 SkTracedAutoMutexAcquire libraryLock(fLibraryMutex);
1652 1703
1653 FT_StreamRec streamRec; 1704 FT_StreamRec streamRec;
1654 FT_Face face = this->openFace(stream, -1, &streamRec); 1705 FT_Face face = this->openFace(stream, -1, &streamRec);
1655 if (nullptr == face) { 1706 if (nullptr == face) {
1656 return false; 1707 return false;
1657 } 1708 }
1658 1709
1659 *numFaces = face->num_faces; 1710 *numFaces = face->num_faces;
1660 1711
1661 FT_Done_Face(face); 1712 FT_Done_Face(face);
1662 return true; 1713 return true;
1663 } 1714 }
1664 1715
1665 #include "SkTSearch.h" 1716 #include "SkTSearch.h"
1666 bool SkTypeface_FreeType::Scanner::scanFont( 1717 bool SkTypeface_FreeType::Scanner::scanFont(
1667 SkStream* stream, int ttcIndex, 1718 SkStream* stream, int ttcIndex,
1668 SkString* name, SkFontStyle* style, bool* isFixedPitch, AxisDefinitions* axe s) const 1719 SkString* name, SkFontStyle* style, bool* isFixedPitch, AxisDefinitions* axe s) const
1669 { 1720 {
1670 SkAutoMutexAcquire libraryLock(fLibraryMutex); 1721 SkTracedAutoMutexAcquire libraryLock(fLibraryMutex);
1671 1722
1672 FT_StreamRec streamRec; 1723 FT_StreamRec streamRec;
1673 FT_Face face = this->openFace(stream, ttcIndex, &streamRec); 1724 FT_Face face = this->openFace(stream, ttcIndex, &streamRec);
1674 if (nullptr == face) { 1725 if (nullptr == face) {
1675 return false; 1726 return false;
1676 } 1727 }
1677 1728
1678 int weight = SkFontStyle::kNormal_Weight; 1729 int weight = SkFontStyle::kNormal_Weight;
1679 int width = SkFontStyle::kNormal_Width; 1730 int width = SkFontStyle::kNormal_Width;
1680 SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant; 1731 SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", 1869 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
1819 name.c_str(), 1870 name.c_str(),
1820 (skTag >> 24) & 0xFF, 1871 (skTag >> 24) & 0xFF,
1821 (skTag >> 16) & 0xFF, 1872 (skTag >> 16) & 0xFF,
1822 (skTag >> 8) & 0xFF, 1873 (skTag >> 8) & 0xFF,
1823 (skTag) & 0xFF)); 1874 (skTag) & 0xFF));
1824 } 1875 }
1825 } 1876 }
1826 ) 1877 )
1827 } 1878 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698