Changeset 167713 in webkit
- Timestamp:
- Apr 23, 2014 10:49:40 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167712 r167713 1 2014-04-22 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [OS X] Make checking if a font is the system font more robust 4 https://bugs.webkit.org/show_bug.cgi?id=132030 5 6 Reviewed by Dean Jackson. 7 8 Instead of inspecting a font's name to determine if it is a system font, 9 on OS X we can ask the system directly. 10 11 This patch also moves a platform-specific check into platform-specific 12 code, so that other platforms don't check for OS X-specific behavior. 13 14 Covered by existing tests. 15 16 * platform/graphics/Font.cpp: 17 (WebCore::Font::hasValidAverageCharWidth): 18 * platform/graphics/Font.h: 19 * platform/graphics/mac/FontMac.mm: 20 (WebCore::Font::primaryFontDataIsSystemFont): 21 1 22 2014-04-23 Philippe Normand <pnormand@igalia.com> 2 23 -
trunk/Source/WebCore/platform/graphics/Font.cpp
r167082 r167713 482 482 return false; 483 483 484 // Internal fonts on OS X also have an invalid entry in the table for avgCharWidth. 485 // They are hidden by having a name that begins with a period, so simply search486 // for that here rather than try to keep the list up to date.487 if (family.startsWith('.'))488 return false; 484 #if PLATFORM(MAC) || PLATFORM(IOS) 485 // Internal fonts on OS X and iOS also have an invalid entry in the table for avgCharWidth. 486 if (primaryFontDataIsSystemFont()) 487 return false; 488 #endif 489 489 490 490 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = 0; -
trunk/Source/WebCore/platform/graphics/Font.h
r167473 r167713 189 189 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simple; } 190 190 static CodePath characterRangeCodePath(const UChar*, unsigned len); 191 192 bool primaryFontDataIsSystemFont() const; 191 193 192 194 private: -
trunk/Source/WebCore/platform/graphics/mac/FontMac.mm
r166322 r167713 35 35 #import <wtf/MathExtras.h> 36 36 37 #if __has_include(<CoreText/CTFontDescriptorPriv.h>) 38 #import <CoreText/CTFontDescriptorPriv.h> 39 #endif 40 extern "C" bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef); 41 37 42 #if ENABLE(LETTERPRESS) 38 43 #import "SoftLinking.h" … … 536 541 #endif 537 542 538 } 543 bool Font::primaryFontDataIsSystemFont() const 544 { 545 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 546 RetainPtr<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(primaryFont()->platformData().ctFont()); 547 return CTFontDescriptorIsSystemUIFont(descriptor.get()); 548 #else 549 return false; 550 #endif 551 } 552 553 }
Note: See TracChangeset
for help on using the changeset viewer.