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

Side by Side Diff: Source/platform/fonts/mac/SimpleFontDataMac.mm

Issue 401553002: Introduce DEFINE_FONT_DATA_TYPE_CASTS, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov 3 * Copyright (C) 2006 Alexey Proskuryakov
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 const SimpleFontData* SimpleFontData::getCompositeFontReferenceFontData(NSFont * key) const 119 const SimpleFontData* SimpleFontData::getCompositeFontReferenceFontData(NSFont * key) const
120 { 120 {
121 if (key && !CFEqual(RetainPtr<CFStringRef>(AdoptCF, CTFontCopyPostScriptName (CTFontRef(key))).get(), CFSTR("LastResort"))) { 121 if (key && !CFEqual(RetainPtr<CFStringRef>(AdoptCF, CTFontCopyPostScriptName (CTFontRef(key))).get(), CFSTR("LastResort"))) {
122 if (!m_derivedFontData) 122 if (!m_derivedFontData)
123 m_derivedFontData = DerivedFontData::create(isCustomFont()); 123 m_derivedFontData = DerivedFontData::create(isCustomFont());
124 if (!m_derivedFontData->compositeFontReferences) 124 if (!m_derivedFontData->compositeFontReferences)
125 m_derivedFontData->compositeFontReferences.adoptCF(CFDictionaryCreat eMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, NULL)); 125 m_derivedFontData->compositeFontReferences.adoptCF(CFDictionaryCreat eMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, NULL));
126 else { 126 else {
127 const SimpleFontData* found = static_cast<const SimpleFontData*>(CFD ictionaryGetValue(m_derivedFontData->compositeFontReferences.get(), static_cast< const void *>(key))); 127 const SimpleFontData* found = toSimpleFontData(CFDictionaryGetValue( m_derivedFontData->compositeFontReferences.get(), static_cast<const void *>(key) ));
128 if (found) 128 if (found)
129 return found; 129 return found;
130 } 130 }
131 if (CFMutableDictionaryRef dictionary = m_derivedFontData->compositeFont References.get()) { 131 if (CFMutableDictionaryRef dictionary = m_derivedFontData->compositeFont References.get()) {
132 NSFont *substituteFont = [key printerFont]; 132 NSFont *substituteFont = [key printerFont];
133 133
134 CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(su bstituteFont)); 134 CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(su bstituteFont));
135 bool syntheticBold = platformData().syntheticBold() && !(traits & kC TFontBoldTrait); 135 bool syntheticBold = platformData().syntheticBold() && !(traits & kC TFontBoldTrait);
136 bool syntheticOblique = platformData().syntheticOblique() && !(trait s & kCTFontItalicTrait); 136 bool syntheticOblique = platformData().syntheticOblique() && !(trait s & kCTFontItalicTrait);
137 137
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0)); 447 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0));
448 if (!CFEqual(runCGFont.get(), cgFont.get())) 448 if (!CFEqual(runCGFont.get(), cgFont.get()))
449 return false; 449 return false;
450 } 450 }
451 451
452 addResult.storedValue->value = true; 452 addResult.storedValue->value = true;
453 return true; 453 return true;
454 } 454 }
455 455
456 } // namespace WebCore 456 } // namespace WebCore
OLDNEW
« Source/platform/fonts/FontFallbackList.cpp ('K') | « Source/platform/fonts/SimpleFontData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698