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

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

Issue 99103006: Moving GraphicsContext and dependencies from core to platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final patch - fixes Android Created 7 years 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 | Annotate | Revision Log
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE. 24 * THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #import "config.h" 27 #import "config.h"
28 #import "core/platform/graphics/SimpleFontData.h" 28 #import "platform/fonts/SimpleFontData.h"
29 29
30 #import <AppKit/AppKit.h> 30 #import <AppKit/AppKit.h>
31 #import <ApplicationServices/ApplicationServices.h> 31 #import <ApplicationServices/ApplicationServices.h>
32 #import <float.h> 32 #import <float.h>
33 #import <unicode/uchar.h> 33 #import <unicode/uchar.h>
34 #import "platform/SharedBuffer.h" 34 #import "platform/SharedBuffer.h"
35 #import "core/platform/graphics/Font.h" 35 #import "platform/fonts/Font.h"
36 #import "core/platform/graphics/FontCache.h" 36 #import "platform/fonts/FontCache.h"
37 #import "platform/fonts/FontDescription.h" 37 #import "platform/fonts/FontDescription.h"
38 #import "platform/geometry/FloatRect.h" 38 #import "platform/geometry/FloatRect.h"
39 #import "platform/graphics/Color.h" 39 #import "platform/graphics/Color.h"
40 #import "platform/mac/BlockExceptions.h" 40 #import "platform/mac/BlockExceptions.h"
41 #import <wtf/Assertions.h> 41 #import <wtf/Assertions.h>
42 #import <wtf/RetainPtr.h> 42 #import <wtf/RetainPtr.h>
43 #import <wtf/StdLibExtras.h> 43 #import <wtf/StdLibExtras.h>
44 #import <wtf/UnusedParam.h> 44 #import <wtf/UnusedParam.h>
45 45
46 @interface NSFont (WebAppKitSecretAPI) 46 @interface NSFont (WebAppKitSecretAPI)
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 // Fallback to a cross-platform estimate, which will populate these values i f they are non-positive. 287 // Fallback to a cross-platform estimate, which will populate these values i f they are non-positive.
288 initCharWidths(); 288 initCharWidths();
289 } 289 }
290 290
291 void SimpleFontData::platformDestroy() 291 void SimpleFontData::platformDestroy()
292 { 292 {
293 if (!isCustomFont() && m_derivedFontData) { 293 if (!isCustomFont() && m_derivedFontData) {
294 // These come from the cache. 294 // These come from the cache.
295 if (m_derivedFontData->smallCaps) 295 if (m_derivedFontData->smallCaps)
296 fontCache()->releaseFontData(m_derivedFontData->smallCaps.get()); 296 FontCache::fontCache()->releaseFontData(m_derivedFontData->smallCaps .get());
297 297
298 if (m_derivedFontData->emphasisMark) 298 if (m_derivedFontData->emphasisMark)
299 fontCache()->releaseFontData(m_derivedFontData->emphasisMark.get()); 299 FontCache::fontCache()->releaseFontData(m_derivedFontData->emphasisM ark.get());
300 } 300 }
301 } 301 }
302 302
303 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo ntDescription& fontDescription, float scaleFactor) const 303 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo ntDescription& fontDescription, float scaleFactor) const
304 { 304 {
305 if (isCustomFont()) { 305 if (isCustomFont()) {
306 FontPlatformData scaledFontData(m_platformData); 306 FontPlatformData scaledFontData(m_platformData);
307 scaledFontData.m_size = scaledFontData.m_size * scaleFactor; 307 scaledFontData.m_size = scaledFontData.m_size * scaleFactor;
308 return SimpleFontData::create(scaledFontData, CustomFontData::create(fal se)); 308 return SimpleFontData::create(scaledFontData, CustomFontData::create(fal se));
309 } 309 }
(...skipping 13 matching lines...) Expand all
323 if (m_platformData.m_syntheticBold) 323 if (m_platformData.m_syntheticBold)
324 fontTraits |= NSBoldFontMask; 324 fontTraits |= NSBoldFontMask;
325 if (m_platformData.m_syntheticOblique) 325 if (m_platformData.m_syntheticOblique)
326 fontTraits |= NSItalicFontMask; 326 fontTraits |= NSItalicFontMask;
327 327
328 NSFontTraitMask scaledFontTraits = [fontManager traitsOfFont:scaledFontD ata.font()]; 328 NSFontTraitMask scaledFontTraits = [fontManager traitsOfFont:scaledFontD ata.font()];
329 scaledFontData.m_syntheticBold = (fontTraits & NSBoldFontMask) && !(scal edFontTraits & NSBoldFontMask); 329 scaledFontData.m_syntheticBold = (fontTraits & NSBoldFontMask) && !(scal edFontTraits & NSBoldFontMask);
330 scaledFontData.m_syntheticOblique = (fontTraits & NSItalicFontMask) && ! (scaledFontTraits & NSItalicFontMask); 330 scaledFontData.m_syntheticOblique = (fontTraits & NSItalicFontMask) && ! (scaledFontTraits & NSItalicFontMask);
331 331
332 // SimpleFontData::platformDestroy() takes care of not deleting the cach ed font data twice. 332 // SimpleFontData::platformDestroy() takes care of not deleting the cach ed font data twice.
333 return fontCache()->fontDataFromFontPlatformData(&scaledFontData); 333 return FontCache::fontCache()->fontDataFromFontPlatformData(&scaledFontD ata);
334 } 334 }
335 END_BLOCK_OBJC_EXCEPTIONS; 335 END_BLOCK_OBJC_EXCEPTIONS;
336 336
337 return 0; 337 return 0;
338 } 338 }
339 339
340 bool SimpleFontData::containsCharacters(const UChar* characters, int length) con st 340 bool SimpleFontData::containsCharacters(const UChar* characters, int length) con st
341 { 341 {
342 NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<uni char*>(characters) length:length freeWhenDone:NO]; 342 NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<uni char*>(characters) length:length freeWhenDone:NO];
343 NSCharacterSet *set = [[m_platformData.font() coveredCharacterSet] invertedS et]; 343 NSCharacterSet *set = [[m_platformData.font() coveredCharacterSet] invertedS et];
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0)); 444 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0));
445 if (!CFEqual(runCGFont.get(), cgFont.get())) 445 if (!CFEqual(runCGFont.get(), cgFont.get()))
446 return false; 446 return false;
447 } 447 }
448 448
449 addResult.iterator->value = true; 449 addResult.iterator->value = true;
450 return true; 450 return true;
451 } 451 }
452 452
453 } // namespace WebCore 453 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/fonts/mac/SimpleFontDataCoreText.cpp ('k') | Source/platform/fonts/opentype/OpenTypeSanitizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698