OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 #endif | 184 #endif |
185 | 185 |
186 void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) cons
t | 186 void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) cons
t |
187 { | 187 { |
188 UNUSED_PARAM(context); | 188 UNUSED_PARAM(context); |
189 paint->setAntiAlias(m_style.useAntiAlias); | 189 paint->setAntiAlias(m_style.useAntiAlias); |
190 paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); | 190 paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); |
191 paint->setEmbeddedBitmapText(m_style.useBitmaps); | 191 paint->setEmbeddedBitmapText(m_style.useBitmaps); |
192 paint->setAutohinted(m_style.useAutoHint); | 192 paint->setAutohinted(m_style.useAutoHint); |
193 paint->setSubpixelText(m_style.useSubpixelPositioning); | |
194 if (m_style.useAntiAlias) | 193 if (m_style.useAntiAlias) |
195 paint->setLCDRenderText(m_style.useSubpixelRendering); | 194 paint->setLCDRenderText(m_style.useSubpixelRendering); |
196 | 195 |
| 196 // TestRunner specifically toggles the subpixel positioning flag. |
| 197 if (RuntimeEnabledFeatures::subpixelFontScalingEnabled() && !isRunningLayout
Test()) |
| 198 paint->setSubpixelText(true); |
| 199 else |
| 200 paint->setSubpixelText(m_style.useSubpixelPositioning); |
| 201 |
197 const float ts = m_textSize >= 0 ? m_textSize : 12; | 202 const float ts = m_textSize >= 0 ? m_textSize : 12; |
198 paint->setTextSize(SkFloatToScalar(ts)); | 203 paint->setTextSize(SkFloatToScalar(ts)); |
199 paint->setTypeface(m_typeface.get()); | 204 paint->setTypeface(m_typeface.get()); |
200 paint->setFakeBoldText(m_fakeBold); | 205 paint->setFakeBoldText(m_fakeBold); |
201 paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0); | 206 paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0); |
202 } | 207 } |
203 | 208 |
204 SkFontID FontPlatformData::uniqueID() const | 209 SkFontID FontPlatformData::uniqueID() const |
205 { | 210 { |
206 return m_typeface->uniqueID(); | 211 return m_typeface->uniqueID(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) | 293 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) |
289 m_style.useSubpixelRendering = useSkiaSubpixelRendering; | 294 m_style.useSubpixelRendering = useSkiaSubpixelRendering; |
290 | 295 |
291 // TestRunner specifically toggles the subpixel positioning flag. | 296 // TestRunner specifically toggles the subpixel positioning flag. |
292 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference | 297 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference |
293 || isRunningLayoutTest()) | 298 || isRunningLayoutTest()) |
294 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; | 299 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; |
295 } | 300 } |
296 | 301 |
297 } // namespace WebCore | 302 } // namespace WebCore |
OLD | NEW |