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

Side by Side Diff: Source/platform/fonts/FontPlatformData.cpp

Issue 175253002: Switch to HarfBuzz on Mac and remove CoreText shaper (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fighting trunk TestExpectation changes Created 6 years, 2 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) 2011 Brent Fulgham 2 * Copyright (C) 2011 Brent Fulgham
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 , m_useSubpixelPositioning(source.m_useSubpixelPositioning) 146 , m_useSubpixelPositioning(source.m_useSubpixelPositioning)
147 , m_minSizeForAntiAlias(source.m_minSizeForAntiAlias) 147 , m_minSizeForAntiAlias(source.m_minSizeForAntiAlias)
148 , m_minSizeForSubpixel(source.m_minSizeForSubpixel) 148 , m_minSizeForSubpixel(source.m_minSizeForSubpixel)
149 #endif 149 #endif
150 { 150 {
151 #if OS(MACOSX) 151 #if OS(MACOSX)
152 platformDataInit(source); 152 platformDataInit(source);
153 #endif 153 #endif
154 } 154 }
155 155
156 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
157 : m_typeface(src.m_typeface)
158 #if !OS(WIN)
159 , m_family(src.m_family)
160 #endif
161 , m_textSize(textSize)
162 , m_syntheticBold(src.m_syntheticBold)
163 , m_syntheticItalic(src.m_syntheticItalic)
164 , m_orientation(src.m_orientation)
165 #if OS(MACOSX)
166 , m_isColorBitmapFont(src.m_isColorBitmapFont)
167 , m_isCompositeFontReference(src.m_isCompositeFontReference)
168 #endif
169 , m_widthVariant(RegularWidth)
170 #if !OS(MACOSX)
171 , m_style(src.m_style)
172 #endif
173 , m_harfBuzzFace(nullptr)
174 , m_isHashTableDeletedValue(false)
175 #if OS(WIN)
176 , m_paintTextFlags(src.m_paintTextFlags)
177 , m_useSubpixelPositioning(src.m_useSubpixelPositioning)
178 , m_minSizeForAntiAlias(src.m_minSizeForAntiAlias)
179 , m_minSizeForSubpixel(src.m_minSizeForSubpixel)
180 #endif
181 {
182 #if OS(MACOSX)
183 platformDataInit(src);
184 #else
185 querySystemForRenderStyle(FontDescription::subpixelPositioning());
186 #endif
187 }
156 188
157 #if OS(MACOSX) 189 #if OS(MACOSX)
158 FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticB old, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVa riant) 190 FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticB old, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVa riant)
159 : m_typeface(nullptr) 191 : m_typeface(nullptr)
160 , m_family(CString()) 192 , m_family(CString())
161 , m_textSize(size) 193 , m_textSize(size)
162 , m_syntheticBold(syntheticBold) 194 , m_syntheticBold(syntheticBold)
163 , m_syntheticItalic(syntheticItalic) 195 , m_syntheticItalic(syntheticItalic)
164 , m_orientation(orientation) 196 , m_orientation(orientation)
165 , m_isColorBitmapFont(false) 197 , m_isColorBitmapFont(false)
(...skipping 21 matching lines...) Expand all
187 #if OS(WIN) 219 #if OS(WIN)
188 , m_paintTextFlags(0) 220 , m_paintTextFlags(0)
189 , m_useSubpixelPositioning(subpixelTextPosition) 221 , m_useSubpixelPositioning(subpixelTextPosition)
190 , m_minSizeForAntiAlias(0) 222 , m_minSizeForAntiAlias(0)
191 , m_minSizeForSubpixel(0) 223 , m_minSizeForSubpixel(0)
192 #endif 224 #endif
193 { 225 {
194 querySystemForRenderStyle(subpixelTextPosition); 226 querySystemForRenderStyle(subpixelTextPosition);
195 } 227 }
196 228
197
198 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
199 : m_typeface(src.m_typeface)
200 #if !OS(WIN)
201 , m_family(src.m_family)
202 #endif
203 , m_textSize(textSize)
204 , m_syntheticBold(src.m_syntheticBold)
205 , m_syntheticItalic(src.m_syntheticItalic)
206 , m_orientation(src.m_orientation)
207 , m_widthVariant(RegularWidth)
208 , m_harfBuzzFace(nullptr)
209 , m_isHashTableDeletedValue(false)
210 #if OS(WIN)
211 , m_paintTextFlags(src.m_paintTextFlags)
212 , m_useSubpixelPositioning(src.m_useSubpixelPositioning)
213 , m_minSizeForAntiAlias(src.m_minSizeForAntiAlias)
214 , m_minSizeForSubpixel(src.m_minSizeForSubpixel)
215 #endif
216 {
217 querySystemForRenderStyle(FontDescription::subpixelPositioning());
218 }
219 #endif 229 #endif
220 230
221 FontPlatformData::~FontPlatformData() 231 FontPlatformData::~FontPlatformData()
222 { 232 {
223 #if OS(MACOSX) 233 #if OS(MACOSX)
224 if (m_font) 234 if (m_font)
225 CFRelease(m_font); 235 CFRelease(m_font);
226 #endif 236 #endif
227 } 237 }
228 238
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 { 332 {
323 #if OS(MACOSX) 333 #if OS(MACOSX)
324 if (!m_typeface) 334 if (!m_typeface)
325 m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont())); 335 m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont()));
326 #endif 336 #endif
327 return m_typeface.get(); 337 return m_typeface.get();
328 } 338 }
329 339
330 HarfBuzzFace* FontPlatformData::harfBuzzFace() const 340 HarfBuzzFace* FontPlatformData::harfBuzzFace() const
331 { 341 {
332 #if OS(MACOSX)
333 CTFontRef font = ctFont();
334 // Keeping the decision not to pass AAT font to HarfBuzz for now,
335 // until we switch to HarfBuzz as a shaper for all cases.
336 if (isAATFont(font))
337 return 0;
338 #endif
339 if (!m_harfBuzzFace) 342 if (!m_harfBuzzFace)
340 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this ), uniqueID()); 343 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this ), uniqueID());
341 344
342 return m_harfBuzzFace.get(); 345 return m_harfBuzzFace.get();
343 } 346 }
344 347
345 } // namespace blink 348 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontPlatformData.h ('k') | Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698