| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com> | 2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com> |
| 3 * Copyright (C) 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "platform/fonts/FontDescription.h" | 31 #include "platform/fonts/FontDescription.h" |
| 32 | 32 |
| 33 #include "platform/RuntimeEnabledFeatures.h" | 33 #include "platform/RuntimeEnabledFeatures.h" |
| 34 #include "wtf/text/AtomicStringHash.h" | 34 #include "wtf/text/AtomicStringHash.h" |
| 35 #include "wtf/text/StringHash.h" | 35 #include "wtf/text/StringHash.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace blink { |
| 38 | 38 |
| 39 struct SameSizeAsFontDescription { | 39 struct SameSizeAsFontDescription { |
| 40 FontFamily familyList; | 40 FontFamily familyList; |
| 41 RefPtr<FontFeatureSettings> m_featureSettings; | 41 RefPtr<FontFeatureSettings> m_featureSettings; |
| 42 String locale; | 42 String locale; |
| 43 float sizes[4]; | 43 float sizes[4]; |
| 44 // FXIME: Make them fit into one word. | 44 // FXIME: Make them fit into one word. |
| 45 uint32_t bitfields; | 45 uint32_t bitfields; |
| 46 uint32_t bitfields2 : 7; | 46 uint32_t bitfields2 : 7; |
| 47 }; | 47 }; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 void FontDescription::updateTypesettingFeatures() const | 156 void FontDescription::updateTypesettingFeatures() const |
| 157 { | 157 { |
| 158 m_typesettingFeatures = s_defaultTypesettingFeatures; | 158 m_typesettingFeatures = s_defaultTypesettingFeatures; |
| 159 | 159 |
| 160 switch (textRendering()) { | 160 switch (textRendering()) { |
| 161 case AutoTextRendering: | 161 case AutoTextRendering: |
| 162 break; | 162 break; |
| 163 case OptimizeSpeed: | 163 case OptimizeSpeed: |
| 164 m_typesettingFeatures &= ~(WebCore::Kerning | Ligatures); | 164 m_typesettingFeatures &= ~(blink::Kerning | Ligatures); |
| 165 break; | 165 break; |
| 166 case GeometricPrecision: | 166 case GeometricPrecision: |
| 167 case OptimizeLegibility: | 167 case OptimizeLegibility: |
| 168 m_typesettingFeatures |= WebCore::Kerning | Ligatures; | 168 m_typesettingFeatures |= blink::Kerning | Ligatures; |
| 169 break; | 169 break; |
| 170 } | 170 } |
| 171 | 171 |
| 172 switch (kerning()) { | 172 switch (kerning()) { |
| 173 case FontDescription::NoneKerning: | 173 case FontDescription::NoneKerning: |
| 174 m_typesettingFeatures &= ~WebCore::Kerning; | 174 m_typesettingFeatures &= ~blink::Kerning; |
| 175 break; | 175 break; |
| 176 case FontDescription::NormalKerning: | 176 case FontDescription::NormalKerning: |
| 177 m_typesettingFeatures |= WebCore::Kerning; | 177 m_typesettingFeatures |= blink::Kerning; |
| 178 break; | 178 break; |
| 179 case FontDescription::AutoKerning: | 179 case FontDescription::AutoKerning: |
| 180 break; | 180 break; |
| 181 } | 181 } |
| 182 | 182 |
| 183 // As per CSS (http://dev.w3.org/csswg/css-text-3/#letter-spacing-property), | 183 // As per CSS (http://dev.w3.org/csswg/css-text-3/#letter-spacing-property), |
| 184 // When the effective letter-spacing between two characters is not zero (due
to | 184 // When the effective letter-spacing between two characters is not zero (due
to |
| 185 // either justification or non-zero computed letter-spacing), user agents sh
ould | 185 // either justification or non-zero computed letter-spacing), user agents sh
ould |
| 186 // not apply optional ligatures. | 186 // not apply optional ligatures. |
| 187 if (m_letterSpacing == 0) { | 187 if (m_letterSpacing == 0) { |
| 188 switch (commonLigaturesState()) { | 188 switch (commonLigaturesState()) { |
| 189 case FontDescription::DisabledLigaturesState: | 189 case FontDescription::DisabledLigaturesState: |
| 190 m_typesettingFeatures &= ~Ligatures; | 190 m_typesettingFeatures &= ~Ligatures; |
| 191 break; | 191 break; |
| 192 case FontDescription::EnabledLigaturesState: | 192 case FontDescription::EnabledLigaturesState: |
| 193 m_typesettingFeatures |= Ligatures; | 193 m_typesettingFeatures |= Ligatures; |
| 194 break; | 194 break; |
| 195 case FontDescription::NormalLigaturesState: | 195 case FontDescription::NormalLigaturesState: |
| 196 break; | 196 break; |
| 197 } | 197 } |
| 198 | 198 |
| 199 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 199 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
| 200 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 200 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
| 201 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { | 201 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { |
| 202 m_typesettingFeatures |= WebCore::Ligatures; | 202 m_typesettingFeatures |= blink::Ligatures; |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace WebCore | 207 } // namespace blink |
| OLD | NEW |