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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 const float ts = m_textSize >= 0 ? m_textSize : 12; | 96 const float ts = m_textSize >= 0 ? m_textSize : 12; |
97 paint->setTextSize(SkFloatToScalar(ts)); | 97 paint->setTextSize(SkFloatToScalar(ts)); |
98 paint->setTypeface(m_typeface.get()); | 98 paint->setTypeface(m_typeface.get()); |
99 paint->setFakeBoldText(m_syntheticBold); | 99 paint->setFakeBoldText(m_syntheticBold); |
100 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); | 100 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); |
101 } | 101 } |
102 | 102 |
103 void FontPlatformData::querySystemForRenderStyle(bool useSkiaSubpixelPositioning
) | 103 void FontPlatformData::querySystemForRenderStyle(bool useSkiaSubpixelPositioning
) |
104 { | 104 { |
105 blink::WebFontRenderStyle style; | 105 WebFontRenderStyle style; |
106 #if OS(ANDROID) | 106 #if OS(ANDROID) |
107 style.setDefaults(); | 107 style.setDefaults(); |
108 #else | 108 #else |
109 // If the font name is missing (i.e. probably a web font) or the sandbox is
disabled, use the system defaults. | 109 // If the font name is missing (i.e. probably a web font) or the sandbox is
disabled, use the system defaults. |
110 if (!m_family.length() || !blink::Platform::current()->sandboxSupport()) { | 110 if (!m_family.length() || !Platform::current()->sandboxSupport()) { |
111 style.setDefaults(); | 111 style.setDefaults(); |
112 } else { | 112 } else { |
113 const int sizeAndStyle = (((int)m_textSize) << 2) | (m_typeface->style()
& 3); | 113 const int sizeAndStyle = (((int)m_textSize) << 2) | (m_typeface->style()
& 3); |
114 blink::Platform::current()->sandboxSupport()->getRenderStyleForStrike(m_
family.data(), sizeAndStyle, &style); | 114 Platform::current()->sandboxSupport()->getRenderStyleForStrike(m_family.
data(), sizeAndStyle, &style); |
115 } | 115 } |
116 #endif | 116 #endif |
117 style.toFontRenderStyle(&m_style); | 117 style.toFontRenderStyle(&m_style); |
118 | 118 |
119 // Fix FontRenderStyle::NoPreference to actual styles. | 119 // Fix FontRenderStyle::NoPreference to actual styles. |
120 if (m_style.useAntiAlias == FontRenderStyle::NoPreference) | 120 if (m_style.useAntiAlias == FontRenderStyle::NoPreference) |
121 m_style.useAntiAlias = useSkiaAntiAlias; | 121 m_style.useAntiAlias = useSkiaAntiAlias; |
122 | 122 |
123 if (!m_style.useHinting) | 123 if (!m_style.useHinting) |
124 m_style.hintStyle = SkPaint::kNo_Hinting; | 124 m_style.hintStyle = SkPaint::kNo_Hinting; |
(...skipping 14 matching lines...) Expand all Loading... |
139 || LayoutTestSupport::isRunningLayoutTest()) | 139 || LayoutTestSupport::isRunningLayoutTest()) |
140 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; | 140 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; |
141 } | 141 } |
142 | 142 |
143 bool FontPlatformData::defaultUseSubpixelPositioning() | 143 bool FontPlatformData::defaultUseSubpixelPositioning() |
144 { | 144 { |
145 return FontDescription::subpixelPositioning(); | 145 return FontDescription::subpixelPositioning(); |
146 } | 146 } |
147 | 147 |
148 } // namespace blink | 148 } // namespace blink |
OLD | NEW |