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

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

Issue 697473005: Pass indication of locally created typeface to SkCreateTypefaceFromCTFont (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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) 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 , m_syntheticBold(false) 46 , m_syntheticBold(false)
47 , m_syntheticItalic(false) 47 , m_syntheticItalic(false)
48 , m_orientation(Horizontal) 48 , m_orientation(Horizontal)
49 #if OS(MACOSX) 49 #if OS(MACOSX)
50 , m_isColorBitmapFont(false) 50 , m_isColorBitmapFont(false)
51 , m_isCompositeFontReference(false) 51 , m_isCompositeFontReference(false)
52 #endif 52 #endif
53 , m_widthVariant(RegularWidth) 53 , m_widthVariant(RegularWidth)
54 #if OS(MACOSX) 54 #if OS(MACOSX)
55 , m_font(nullptr) 55 , m_font(nullptr)
56 , m_localFont(false)
56 #else 57 #else
57 , m_style(FontRenderStyle()) 58 , m_style(FontRenderStyle())
58 #endif 59 #endif
59 , m_isHashTableDeletedValue(true) 60 , m_isHashTableDeletedValue(true)
60 #if OS(WIN) 61 #if OS(WIN)
61 , m_paintTextFlags(0) 62 , m_paintTextFlags(0)
62 , m_useSubpixelPositioning(false) 63 , m_useSubpixelPositioning(false)
63 , m_minSizeForAntiAlias(0) 64 , m_minSizeForAntiAlias(0)
64 , m_minSizeForSubpixel(0) 65 , m_minSizeForSubpixel(0)
65 #endif 66 #endif
66 { 67 {
67 } 68 }
68 69
69 FontPlatformData::FontPlatformData() 70 FontPlatformData::FontPlatformData()
70 : m_typeface(nullptr) 71 : m_typeface(nullptr)
71 #if !OS(WIN) 72 #if !OS(WIN)
72 , m_family(CString()) 73 , m_family(CString())
73 #endif 74 #endif
74 , m_textSize(0) 75 , m_textSize(0)
75 , m_syntheticBold(false) 76 , m_syntheticBold(false)
76 , m_syntheticItalic(false) 77 , m_syntheticItalic(false)
77 , m_orientation(Horizontal) 78 , m_orientation(Horizontal)
78 #if OS(MACOSX) 79 #if OS(MACOSX)
79 , m_isColorBitmapFont(false) 80 , m_isColorBitmapFont(false)
80 , m_isCompositeFontReference(false) 81 , m_isCompositeFontReference(false)
81 #endif 82 #endif
82 , m_widthVariant(RegularWidth) 83 , m_widthVariant(RegularWidth)
83 #if OS(MACOSX) 84 #if OS(MACOSX)
84 , m_font(nullptr) 85 , m_font(nullptr)
86 , m_localFont(false)
85 #else 87 #else
86 , m_style(FontRenderStyle()) 88 , m_style(FontRenderStyle())
87 #endif 89 #endif
88 , m_isHashTableDeletedValue(false) 90 , m_isHashTableDeletedValue(false)
89 #if OS(WIN) 91 #if OS(WIN)
90 , m_paintTextFlags(0) 92 , m_paintTextFlags(0)
91 , m_useSubpixelPositioning(false) 93 , m_useSubpixelPositioning(false)
92 , m_minSizeForAntiAlias(0) 94 , m_minSizeForAntiAlias(0)
93 , m_minSizeForSubpixel(0) 95 , m_minSizeForSubpixel(0)
94 #endif 96 #endif
95 { 97 {
96 } 98 }
97 99
98 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti cItalic, FontOrientation orientation, FontWidthVariant widthVariant) 100 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti cItalic, FontOrientation orientation, FontWidthVariant widthVariant)
99 : m_typeface(nullptr) 101 : m_typeface(nullptr)
100 #if !OS(WIN) 102 #if !OS(WIN)
101 , m_family(CString()) 103 , m_family(CString())
102 #endif 104 #endif
103 , m_textSize(size) 105 , m_textSize(size)
104 , m_syntheticBold(syntheticBold) 106 , m_syntheticBold(syntheticBold)
105 , m_syntheticItalic(syntheticItalic) 107 , m_syntheticItalic(syntheticItalic)
106 , m_orientation(orientation) 108 , m_orientation(orientation)
107 #if OS(MACOSX) 109 #if OS(MACOSX)
108 , m_isColorBitmapFont(false) 110 , m_isColorBitmapFont(false)
109 , m_isCompositeFontReference(false) 111 , m_isCompositeFontReference(false)
110 #endif 112 #endif
111 , m_widthVariant(widthVariant) 113 , m_widthVariant(widthVariant)
112 #if OS(MACOSX) 114 #if OS(MACOSX)
113 , m_font(nullptr) 115 , m_font(nullptr)
116 , m_localFont(false)
114 #else 117 #else
115 , m_style(FontRenderStyle()) 118 , m_style(FontRenderStyle())
116 #endif 119 #endif
117 , m_isHashTableDeletedValue(false) 120 , m_isHashTableDeletedValue(false)
118 #if OS(WIN) 121 #if OS(WIN)
119 , m_paintTextFlags(0) 122 , m_paintTextFlags(0)
120 , m_useSubpixelPositioning(false) 123 , m_useSubpixelPositioning(false)
121 , m_minSizeForAntiAlias(0) 124 , m_minSizeForAntiAlias(0)
122 , m_minSizeForSubpixel(0) 125 , m_minSizeForSubpixel(0)
123 #endif 126 #endif
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 #endif 185 #endif
183 { 186 {
184 #if OS(MACOSX) 187 #if OS(MACOSX)
185 platformDataInit(src); 188 platformDataInit(src);
186 #else 189 #else
187 querySystemForRenderStyle(FontDescription::subpixelPositioning()); 190 querySystemForRenderStyle(FontDescription::subpixelPositioning());
188 #endif 191 #endif
189 } 192 }
190 193
191 #if OS(MACOSX) 194 #if OS(MACOSX)
192 FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticB old, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVa riant) 195 FontPlatformData::FontPlatformData(CGFontRef cgFont, bool localFont, float size, bool syntheticBold, bool syntheticItalic, FontOrientation orientation, FontWidt hVariant widthVariant)
193 : m_typeface(nullptr) 196 : m_typeface(nullptr)
194 , m_family(CString()) 197 , m_family(CString())
195 , m_textSize(size) 198 , m_textSize(size)
196 , m_syntheticBold(syntheticBold) 199 , m_syntheticBold(syntheticBold)
197 , m_syntheticItalic(syntheticItalic) 200 , m_syntheticItalic(syntheticItalic)
198 , m_orientation(orientation) 201 , m_orientation(orientation)
199 , m_isColorBitmapFont(false) 202 , m_isColorBitmapFont(false)
200 , m_isCompositeFontReference(false) 203 , m_isCompositeFontReference(false)
201 , m_widthVariant(widthVariant) 204 , m_widthVariant(widthVariant)
202 , m_font(nullptr) 205 , m_font(nullptr)
203 , m_cgFont(cgFont) 206 , m_cgFont(cgFont)
207 , m_localFont(localFont)
204 , m_isHashTableDeletedValue(false) 208 , m_isHashTableDeletedValue(false)
205 { 209 {
206 } 210 }
207 211
208 #else 212 #else
209 213
210 FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family , float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation orie ntation, bool subpixelTextPosition) 214 FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family , float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation orie ntation, bool subpixelTextPosition)
211 : m_typeface(tf) 215 : m_typeface(tf)
212 #if !OS(WIN) 216 #if !OS(WIN)
213 , m_family(family) 217 , m_family(family)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 && m_textSize == a.m_textSize 301 && m_textSize == a.m_textSize
298 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue 302 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue
299 && m_syntheticBold == a.m_syntheticBold 303 && m_syntheticBold == a.m_syntheticBold
300 && m_syntheticItalic == a.m_syntheticItalic 304 && m_syntheticItalic == a.m_syntheticItalic
301 && m_orientation == a.m_orientation 305 && m_orientation == a.m_orientation
302 #if !OS(MACOSX) 306 #if !OS(MACOSX)
303 && m_style == a.m_style 307 && m_style == a.m_style
304 #else 308 #else
305 && m_isColorBitmapFont == a.m_isColorBitmapFont 309 && m_isColorBitmapFont == a.m_isColorBitmapFont
306 && m_isCompositeFontReference == a.m_isCompositeFontReference 310 && m_isCompositeFontReference == a.m_isCompositeFontReference
311 && m_localFont == a.m_localFont
307 #endif 312 #endif
308 && m_widthVariant == a.m_widthVariant; 313 && m_widthVariant == a.m_widthVariant;
309 } 314 }
310 315
311 SkFontID FontPlatformData::uniqueID() const 316 SkFontID FontPlatformData::uniqueID() const
312 { 317 {
313 return typeface()->uniqueID(); 318 return typeface()->uniqueID();
314 } 319 }
315 320
316 String FontPlatformData::fontFamilyName() const 321 String FontPlatformData::fontFamilyName() const
(...skipping 10 matching lines...) Expand all
327 332
328 bool FontPlatformData::isFixedPitch() const 333 bool FontPlatformData::isFixedPitch() const
329 { 334 {
330 return typeface() && typeface()->isFixedPitch(); 335 return typeface() && typeface()->isFixedPitch();
331 } 336 }
332 337
333 SkTypeface* FontPlatformData::typeface() const 338 SkTypeface* FontPlatformData::typeface() const
334 { 339 {
335 #if OS(MACOSX) 340 #if OS(MACOSX)
336 if (!m_typeface) 341 if (!m_typeface)
337 m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont())); 342 m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont(), m_localFont)) ;
338 #endif 343 #endif
339 return m_typeface.get(); 344 return m_typeface.get();
340 } 345 }
341 346
342 HarfBuzzFace* FontPlatformData::harfBuzzFace() const 347 HarfBuzzFace* FontPlatformData::harfBuzzFace() const
343 { 348 {
344 if (!m_harfBuzzFace) 349 if (!m_harfBuzzFace)
345 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this ), uniqueID()); 350 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this ), uniqueID());
346 351
347 return m_harfBuzzFace.get(); 352 return m_harfBuzzFace.get();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (tableSize) { 396 if (tableSize) {
392 Vector<char> tableBuffer(tableSize); 397 Vector<char> tableBuffer(tableSize);
393 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); 398 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]);
394 buffer = SharedBuffer::adoptVector(tableBuffer); 399 buffer = SharedBuffer::adoptVector(tableBuffer);
395 } 400 }
396 return buffer.release(); 401 return buffer.release();
397 } 402 }
398 #endif 403 #endif
399 404
400 } // namespace blink 405 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontPlatformData.h ('k') | Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698