OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBol
d, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVari
ant) | 73 FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBol
d, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVari
ant) |
74 : m_textSize(size) | 74 : m_textSize(size) |
75 , m_syntheticBold(syntheticBold) | 75 , m_syntheticBold(syntheticBold) |
76 , m_syntheticItalic(syntheticItalic) | 76 , m_syntheticItalic(syntheticItalic) |
77 , m_orientation(orientation) | 77 , m_orientation(orientation) |
78 , m_isColorBitmapFont(false) | 78 , m_isColorBitmapFont(false) |
79 , m_isCompositeFontReference(false) | 79 , m_isCompositeFontReference(false) |
80 , m_widthVariant(widthVariant) | 80 , m_widthVariant(widthVariant) |
81 , m_font(nsFont) | 81 , m_font(nsFont) |
| 82 , m_localFont(false) |
82 , m_isHashTableDeletedValue(false) | 83 , m_isHashTableDeletedValue(false) |
83 { | 84 { |
84 ASSERT_ARG(nsFont, nsFont); | 85 ASSERT_ARG(nsFont, nsFont); |
85 | 86 |
86 CGFontRef cgFont = 0; | 87 CGFontRef cgFont = 0; |
87 loadFont(nsFont, size, m_font, cgFont); | 88 loadFont(nsFont, size, m_font, cgFont); |
88 | 89 |
89 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 | 90 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 |
90 // FIXME: Chromium: The following code isn't correct for the Chromium port s
ince the sandbox might | 91 // FIXME: Chromium: The following code isn't correct for the Chromium port s
ince the sandbox might |
91 // have blocked font loading, in which case we'll only have the real loaded
font file after the call to loadFont(). | 92 // have blocked font loading, in which case we'll only have the real loaded
font file after the call to loadFont(). |
(...skipping 11 matching lines...) Expand all Loading... |
103 | 104 |
104 m_cgFont.adoptCF(cgFont); | 105 m_cgFont.adoptCF(cgFont); |
105 } | 106 } |
106 | 107 |
107 void FontPlatformData::platformDataInit(const FontPlatformData& f) | 108 void FontPlatformData::platformDataInit(const FontPlatformData& f) |
108 { | 109 { |
109 m_font = f.m_font ? [f.m_font retain] : f.m_font; | 110 m_font = f.m_font ? [f.m_font retain] : f.m_font; |
110 | 111 |
111 m_cgFont = f.m_cgFont; | 112 m_cgFont = f.m_cgFont; |
112 m_CTFont = f.m_CTFont; | 113 m_CTFont = f.m_CTFont; |
| 114 m_localFont = f.m_localFont; |
113 | 115 |
114 m_inMemoryFont = f.m_inMemoryFont; | 116 m_inMemoryFont = f.m_inMemoryFont; |
115 m_harfBuzzFace = f.m_harfBuzzFace; | 117 m_harfBuzzFace = f.m_harfBuzzFace; |
116 m_typeface = f.m_typeface; | 118 m_typeface = f.m_typeface; |
117 } | 119 } |
118 | 120 |
119 const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformD
ata& f) | 121 const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformD
ata& f) |
120 { | 122 { |
121 m_cgFont = f.m_cgFont; | 123 m_cgFont = f.m_cgFont; |
122 if (m_font == f.m_font) | 124 if (m_font == f.m_font) |
123 return *this; | 125 return *this; |
124 if (f.m_font) | 126 if (f.m_font) |
125 CFRetain(f.m_font); | 127 CFRetain(f.m_font); |
126 if (m_font) | 128 if (m_font) |
127 CFRelease(m_font); | 129 CFRelease(m_font); |
128 m_font = f.m_font; | 130 m_font = f.m_font; |
129 m_CTFont = f.m_CTFont; | 131 m_CTFont = f.m_CTFont; |
| 132 m_localFont = f.m_localFont; |
130 | 133 |
131 m_inMemoryFont = f.m_inMemoryFont; | 134 m_inMemoryFont = f.m_inMemoryFont; |
132 m_harfBuzzFace = f.m_harfBuzzFace; | 135 m_harfBuzzFace = f.m_harfBuzzFace; |
133 m_typeface = f.m_typeface; | 136 m_typeface = f.m_typeface; |
134 | 137 |
135 return *this; | 138 return *this; |
136 } | 139 } |
137 | 140 |
138 | 141 |
139 void FontPlatformData::setFont(NSFont *font) | 142 void FontPlatformData::setFont(NSFont *font) |
(...skipping 25 matching lines...) Expand all Loading... |
165 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 | 168 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 |
166 { | 169 { |
167 CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font
)); | 170 CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font
)); |
168 m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait; | 171 m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait; |
169 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 | 172 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
170 m_isCompositeFontReference = traits & kCTFontCompositeTrait; | 173 m_isCompositeFontReference = traits & kCTFontCompositeTrait; |
171 #endif | 174 #endif |
172 } | 175 } |
173 #endif | 176 #endif |
174 m_CTFont = nullptr; | 177 m_CTFont = nullptr; |
| 178 m_localFont = false; |
175 } | 179 } |
176 | 180 |
177 bool FontPlatformData::roundsGlyphAdvances() const | 181 bool FontPlatformData::roundsGlyphAdvances() const |
178 { | 182 { |
179 return [m_font renderingMode] == NSFontAntialiasedIntegerAdvancementsRenderi
ngMode; | 183 return [m_font renderingMode] == NSFontAntialiasedIntegerAdvancementsRenderi
ngMode; |
180 } | 184 } |
181 | 185 |
182 bool FontPlatformData::allowsLigatures() const | 186 bool FontPlatformData::allowsLigatures() const |
183 { | 187 { |
184 return ![[m_font coveredCharacterSet] characterIsMember:'a']; | 188 return ![[m_font coveredCharacterSet] characterIsMember:'a']; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(new
Descriptor.get(), m_textSize, 0)); | 289 RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(new
Descriptor.get(), m_textSize, 0)); |
286 | 290 |
287 if (newFont) | 291 if (newFont) |
288 m_CTFont = newFont; | 292 m_CTFont = newFont; |
289 } | 293 } |
290 | 294 |
291 return m_CTFont.get(); | 295 return m_CTFont.get(); |
292 } | 296 } |
293 | 297 |
294 } // namespace blink | 298 } // namespace blink |
OLD | NEW |