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

Side by Side Diff: Source/core/platform/graphics/cocoa/FontPlatformDataCocoa.mm

Issue 14107015: Rename OS(DARWIN) to OS(MACOSX). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 3 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 * This file is part of the internal font implementation. 2 * This file is part of the internal font implementation.
3 * 3 *
4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
5 * Copyright (c) 2010 Google Inc. All rights reserved. 5 * Copyright (c) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 10 matching lines...) Expand all
21 * 21 *
22 */ 22 */
23 23
24 #import "config.h" 24 #import "config.h"
25 #import "core/platform/graphics/FontPlatformData.h" 25 #import "core/platform/graphics/FontPlatformData.h"
26 26
27 #import <AppKit/NSFont.h> 27 #import <AppKit/NSFont.h>
28 #import <AvailabilityMacros.h> 28 #import <AvailabilityMacros.h>
29 #import <wtf/text/WTFString.h> 29 #import <wtf/text/WTFString.h>
30 30
31 #if OS(DARWIN) 31 #if OS(MACOSX)
32 #import "core/platform/graphics/harfbuzz/HarfBuzzFace.h" 32 #import "core/platform/graphics/harfbuzz/HarfBuzzFace.h"
33 #endif 33 #endif
34 34
35 namespace WebCore { 35 namespace WebCore {
36 36
37 // These CoreText Text Spacing feature selectors are not defined in CoreText. 37 // These CoreText Text Spacing feature selectors are not defined in CoreText.
38 enum TextSpacingCTFeatureSelector { TextSpacingProportional, TextSpacingFullWidt h, TextSpacingHalfWidth, TextSpacingThirdWidth, TextSpacingQuarterWidth }; 38 enum TextSpacingCTFeatureSelector { TextSpacingProportional, TextSpacingFullWidt h, TextSpacingHalfWidth, TextSpacingThirdWidth, TextSpacingQuarterWidth };
39 39
40 FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool isPrinterFon t, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontW idthVariant widthVariant) 40 FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool isPrinterFon t, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontW idthVariant widthVariant)
41 : m_syntheticBold(syntheticBold) 41 : m_syntheticBold(syntheticBold)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 CFRelease(m_font); 77 CFRelease(m_font);
78 } 78 }
79 79
80 void FontPlatformData::platformDataInit(const FontPlatformData& f) 80 void FontPlatformData::platformDataInit(const FontPlatformData& f)
81 { 81 {
82 m_font = f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1) ? [f.m_font retain] : f.m_font; 82 m_font = f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1) ? [f.m_font retain] : f.m_font;
83 83
84 m_cgFont = f.m_cgFont; 84 m_cgFont = f.m_cgFont;
85 m_CTFont = f.m_CTFont; 85 m_CTFont = f.m_CTFont;
86 86
87 #if OS(DARWIN) 87 #if OS(MACOSX)
88 m_inMemoryFont = f.m_inMemoryFont; 88 m_inMemoryFont = f.m_inMemoryFont;
89 m_harfBuzzFace = f.m_harfBuzzFace; 89 m_harfBuzzFace = f.m_harfBuzzFace;
90 #endif 90 #endif
91 } 91 }
92 92
93 const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformD ata& f) 93 const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformD ata& f)
94 { 94 {
95 m_cgFont = f.m_cgFont; 95 m_cgFont = f.m_cgFont;
96 if (m_font == f.m_font) 96 if (m_font == f.m_font)
97 return *this; 97 return *this;
98 if (f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1)) 98 if (f.m_font && f.m_font != reinterpret_cast<NSFont *>(-1))
99 CFRetain(f.m_font); 99 CFRetain(f.m_font);
100 if (m_font && m_font != reinterpret_cast<NSFont *>(-1)) 100 if (m_font && m_font != reinterpret_cast<NSFont *>(-1))
101 CFRelease(m_font); 101 CFRelease(m_font);
102 m_font = f.m_font; 102 m_font = f.m_font;
103 m_CTFont = f.m_CTFont; 103 m_CTFont = f.m_CTFont;
104 #if OS(DARWIN) 104 #if OS(MACOSX)
105 m_inMemoryFont = f.m_inMemoryFont; 105 m_inMemoryFont = f.m_inMemoryFont;
106 m_harfBuzzFace = f.m_harfBuzzFace; 106 m_harfBuzzFace = f.m_harfBuzzFace;
107 #endif 107 #endif
108 return *this; 108 return *this;
109 } 109 }
110 110
111 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const 111 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
112 { 112 {
113 if (m_font || other.m_font) 113 if (m_font || other.m_font)
114 return m_font == other.m_font; 114 return m_font == other.m_font;
(...skipping 11 matching lines...) Expand all
126 CFRetain(font); 126 CFRetain(font);
127 if (m_font) 127 if (m_font)
128 CFRelease(m_font); 128 CFRelease(m_font);
129 m_font = font; 129 m_font = font;
130 m_size = [font pointSize]; 130 m_size = [font pointSize];
131 131
132 CGFontRef cgFont = 0; 132 CGFontRef cgFont = 0;
133 NSFont* loadedFont = 0; 133 NSFont* loadedFont = 0;
134 loadFont(m_font, m_size, loadedFont, cgFont); 134 loadFont(m_font, m_size, loadedFont, cgFont);
135 135
136 #if OS(DARWIN) 136 #if OS(MACOSX)
137 // If loadFont replaced m_font with a fallback font, then release the 137 // If loadFont replaced m_font with a fallback font, then release the
138 // previous font to counter the retain above. Then retain the new font. 138 // previous font to counter the retain above. Then retain the new font.
139 if (loadedFont != m_font) { 139 if (loadedFont != m_font) {
140 CFRelease(m_font); 140 CFRelease(m_font);
141 CFRetain(loadedFont); 141 CFRetain(loadedFont);
142 m_font = loadedFont; 142 m_font = loadedFont;
143 } 143 }
144 #endif 144 #endif
145 145
146 m_cgFont.adoptCF(cgFont); 146 m_cgFont.adoptCF(cgFont);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 RetainPtr<CTFontDescriptorRef> newDescriptor(AdoptCF, CTFontDescriptorCr eateCopyWithFeature(sourceDescriptor.get(), featureType.get(), featureSelector.g et())); 271 RetainPtr<CTFontDescriptorRef> newDescriptor(AdoptCF, CTFontDescriptorCr eateCopyWithFeature(sourceDescriptor.get(), featureType.get(), featureSelector.g et()));
272 RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(new Descriptor.get(), m_size, 0)); 272 RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(new Descriptor.get(), m_size, 0));
273 273
274 if (newFont) 274 if (newFont)
275 m_CTFont = newFont; 275 m_CTFont = newFont;
276 } 276 }
277 277
278 return m_CTFont.get(); 278 return m_CTFont.get();
279 } 279 }
280 280
281 #if OS(DARWIN) 281 #if OS(MACOSX)
282 static bool isAATFont(CTFontRef ctFont) 282 static bool isAATFont(CTFontRef ctFont)
283 { 283 {
284 CFDataRef table = CTFontCopyTable(ctFont, kCTFontTableMort, 0); 284 CFDataRef table = CTFontCopyTable(ctFont, kCTFontTableMort, 0);
285 if (table) { 285 if (table) {
286 CFRelease(table); 286 CFRelease(table);
287 return true; 287 return true;
288 } 288 }
289 table = CTFontCopyTable(ctFont, kCTFontTableMorx, 0); 289 table = CTFontCopyTable(ctFont, kCTFontTableMorx, 0);
290 if (table) { 290 if (table) {
291 CFRelease(table); 291 CFRelease(table);
(...skipping 20 matching lines...) Expand all
312 #ifndef NDEBUG 312 #ifndef NDEBUG
313 String FontPlatformData::description() const 313 String FontPlatformData::description() const
314 { 314 {
315 RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont() )); 315 RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont() ));
316 return String(cgFontDescription.get()) + " " + String::number(m_size) 316 return String(cgFontDescription.get()) + " " + String::number(m_size)
317 + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : ""); 317 + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : "");
318 } 318 }
319 #endif 319 #endif
320 320
321 } // namespace WebCore 321 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/SimpleFontData.h ('k') | Source/core/platform/graphics/gpu/DrawingBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698