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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/mac/FontPlatformDataMac.mm

Issue 2386333002: reflow comments in platform/fonts (Closed)
Patch Set: comments Created 4 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 * 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 case Antialiased: 121 case Antialiased:
122 shouldSmoothFonts = false; 122 shouldSmoothFonts = false;
123 break; 123 break;
124 case SubpixelAntialiased: 124 case SubpixelAntialiased:
125 break; 125 break;
126 case NoSmoothing: 126 case NoSmoothing:
127 shouldAntialias = false; 127 shouldAntialias = false;
128 shouldSmoothFonts = false; 128 shouldSmoothFonts = false;
129 break; 129 break;
130 case AutoSmoothing: 130 case AutoSmoothing:
131 // For the AutoSmooth case, don't do anything! Keep the default settings . 131 // For the AutoSmooth case, don't do anything! Keep the default
132 // settings.
132 break; 133 break;
133 } 134 }
134 } 135 }
135 136
136 if (LayoutTestSupport::isRunningLayoutTest()) { 137 if (LayoutTestSupport::isRunningLayoutTest()) {
137 shouldSmoothFonts = false; 138 shouldSmoothFonts = false;
138 shouldAntialias = shouldAntialias && 139 shouldAntialias = shouldAntialias &&
139 LayoutTestSupport::isFontAntialiasingEnabledForTest(); 140 LayoutTestSupport::isFontAntialiasingEnabledForTest();
140 } 141 }
141 142
142 paint->setAntiAlias(shouldAntialias); 143 paint->setAntiAlias(shouldAntialias);
143 paint->setEmbeddedBitmapText(false); 144 paint->setEmbeddedBitmapText(false);
144 const float ts = m_textSize >= 0 ? m_textSize : 12; 145 const float ts = m_textSize >= 0 ? m_textSize : 12;
145 paint->setTextSize(SkFloatToScalar(ts)); 146 paint->setTextSize(SkFloatToScalar(ts));
146 paint->setTypeface(m_typeface); 147 paint->setTypeface(m_typeface);
147 paint->setFakeBoldText(m_syntheticBold); 148 paint->setFakeBoldText(m_syntheticBold);
148 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); 149 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0);
149 paint->setLCDRenderText(shouldSmoothFonts); 150 paint->setLCDRenderText(shouldSmoothFonts);
150 paint->setSubpixelText(true); 151 paint->setSubpixelText(true);
151 152
152 // When rendering using CoreGraphics, disable hinting when webkit-font-smoothi ng:antialiased or 153 // When rendering using CoreGraphics, disable hinting when
153 // text-rendering:geometricPrecision is used. 154 // webkit-font-smoothing:antialiased or text-rendering:geometricPrecision is
154 // See crbug.com/152304 155 // used. See crbug.com/152304
155 if (font && 156 if (font &&
156 (font->getFontDescription().fontSmoothing() == Antialiased || 157 (font->getFontDescription().fontSmoothing() == Antialiased ||
157 font->getFontDescription().textRendering() == GeometricPrecision)) 158 font->getFontDescription().textRendering() == GeometricPrecision))
158 paint->setHinting(SkPaint::kNo_Hinting); 159 paint->setHinting(SkPaint::kNo_Hinting);
159 } 160 }
160 161
161 FontPlatformData::FontPlatformData(NSFont* nsFont, 162 FontPlatformData::FontPlatformData(NSFont* nsFont,
162 float size, 163 float size,
163 bool syntheticBold, 164 bool syntheticBold,
164 bool syntheticItalic, 165 bool syntheticItalic,
165 FontOrientation orientation) 166 FontOrientation orientation)
166 : m_textSize(size), 167 : m_textSize(size),
167 m_syntheticBold(syntheticBold), 168 m_syntheticBold(syntheticBold),
168 m_syntheticItalic(syntheticItalic), 169 m_syntheticItalic(syntheticItalic),
169 m_orientation(orientation), 170 m_orientation(orientation),
170 m_isHashTableDeletedValue(false) { 171 m_isHashTableDeletedValue(false) {
171 DCHECK(nsFont); 172 DCHECK(nsFont);
172 if (canLoadInProcess(nsFont)) { 173 if (canLoadInProcess(nsFont)) {
173 m_typeface.reset(SkCreateTypefaceFromCTFont(toCTFontRef(nsFont))); 174 m_typeface.reset(SkCreateTypefaceFromCTFont(toCTFontRef(nsFont)));
174 } else { 175 } else {
175 // In process loading fails for cases where third party font manager softwar e 176 // In process loading fails for cases where third party font manager
176 // registers fonts in non system locations such as /Library/Fonts 177 // software registers fonts in non system locations such as /Library/Fonts
177 // and ~/Library Fonts, see crbug.com/72727 or crbug.com/108645. 178 // and ~/Library Fonts, see crbug.com/72727 or crbug.com/108645.
178 m_typeface = loadFromBrowserProcess(nsFont, size); 179 m_typeface = loadFromBrowserProcess(nsFont, size);
179 } 180 }
180 } 181 }
181 182
182 } // namespace blink 183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698