| 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 21 matching lines...) Expand all Loading... |
| 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 blink { | 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 AtomicString 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 }; |
| 48 | 48 |
| 49 static_assert(sizeof(FontDescription) == sizeof(SameSizeAsFontDescription), "Fon
tDescription should stay small"); | 49 static_assert(sizeof(FontDescription) == sizeof(SameSizeAsFontDescription), "Fon
tDescription should stay small"); |
| 50 | 50 |
| 51 TypesettingFeatures FontDescription::s_defaultTypesettingFeatures = 0; | 51 TypesettingFeatures FontDescription::s_defaultTypesettingFeatures = 0; |
| 52 | 52 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 VariantLigatures ligatures; | 116 VariantLigatures ligatures; |
| 117 | 117 |
| 118 ligatures.common = commonLigaturesState(); | 118 ligatures.common = commonLigaturesState(); |
| 119 ligatures.discretionary = discretionaryLigaturesState(); | 119 ligatures.discretionary = discretionaryLigaturesState(); |
| 120 ligatures.historical = historicalLigaturesState(); | 120 ligatures.historical = historicalLigaturesState(); |
| 121 ligatures.contextual = contextualLigaturesState(); | 121 ligatures.contextual = contextualLigaturesState(); |
| 122 | 122 |
| 123 return ligatures; | 123 return ligatures; |
| 124 } | 124 } |
| 125 | 125 |
| 126 static const AtomicString& defaultLocale() |
| 127 { |
| 128 DEFINE_STATIC_LOCAL(AtomicString, locale, ()); |
| 129 if (locale.isNull()) |
| 130 locale = AtomicString("en"); |
| 131 return locale; |
| 132 } |
| 133 |
| 134 const AtomicString& FontDescription::locale() const |
| 135 { |
| 136 if (m_locale.isNull()) |
| 137 return defaultLocale(); |
| 138 return m_locale; |
| 139 } |
| 140 |
| 126 void FontDescription::setTraits(FontTraits traits) | 141 void FontDescription::setTraits(FontTraits traits) |
| 127 { | 142 { |
| 128 setStyle(traits.style()); | 143 setStyle(traits.style()); |
| 129 setVariant(traits.variant()); | 144 setVariant(traits.variant()); |
| 130 setWeight(traits.weight()); | 145 setWeight(traits.weight()); |
| 131 setStretch(traits.stretch()); | 146 setStretch(traits.stretch()); |
| 132 } | 147 } |
| 133 | 148 |
| 134 void FontDescription::setVariantLigatures(const VariantLigatures& ligatures) | 149 void FontDescription::setVariantLigatures(const VariantLigatures& ligatures) |
| 135 { | 150 { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 233 |
| 219 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 234 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
| 220 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 235 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
| 221 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { | 236 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { |
| 222 m_typesettingFeatures |= blink::Ligatures; | 237 m_typesettingFeatures |= blink::Ligatures; |
| 223 } | 238 } |
| 224 } | 239 } |
| 225 } | 240 } |
| 226 | 241 |
| 227 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |