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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 ASSERT_NOT_REACHED(); | 95 ASSERT_NOT_REACHED(); |
96 return FontWeightNormal; | 96 return FontWeightNormal; |
97 } | 97 } |
98 | 98 |
99 FontTraits FontDescription::traits() const | 99 FontTraits FontDescription::traits() const |
100 { | 100 { |
101 return FontTraits(style(), variant(), weight(), stretch()); | 101 return FontTraits(style(), variant(), weight(), stretch()); |
102 } | 102 } |
103 | 103 |
| 104 FontDescription::VariantLigatures FontDescription::variantLigatures() const |
| 105 { |
| 106 VariantLigatures ligatures; |
| 107 |
| 108 ligatures.common = commonLigaturesState(); |
| 109 ligatures.discretionary = discretionaryLigaturesState(); |
| 110 ligatures.historical = historicalLigaturesState(); |
| 111 ligatures.contextual = contextualLigaturesState(); |
| 112 |
| 113 return ligatures; |
| 114 } |
| 115 |
104 void FontDescription::setTraits(FontTraits traits) | 116 void FontDescription::setTraits(FontTraits traits) |
105 { | 117 { |
106 setStyle(traits.style()); | 118 setStyle(traits.style()); |
107 setVariant(traits.variant()); | 119 setVariant(traits.variant()); |
108 setWeight(traits.weight()); | 120 setWeight(traits.weight()); |
109 setStretch(traits.stretch()); | 121 setStretch(traits.stretch()); |
110 } | 122 } |
111 | 123 |
| 124 void FontDescription::setVariantLigatures(const VariantLigatures& ligatures) |
| 125 { |
| 126 m_commonLigaturesState = ligatures.common; |
| 127 m_discretionaryLigaturesState = ligatures.discretionary; |
| 128 m_historicalLigaturesState = ligatures.historical; |
| 129 m_contextualLigaturesState = ligatures.contextual; |
| 130 |
| 131 updateTypesettingFeatures(); |
| 132 } |
| 133 |
112 FontDescription FontDescription::makeNormalFeatureSettings() const | 134 FontDescription FontDescription::makeNormalFeatureSettings() const |
113 { | 135 { |
114 FontDescription normalDescription(*this); | 136 FontDescription normalDescription(*this); |
115 normalDescription.setFeatureSettings(nullptr); | 137 normalDescription.setFeatureSettings(nullptr); |
116 return normalDescription; | 138 return normalDescription; |
117 } | 139 } |
118 | 140 |
119 float FontDescription::effectiveFontSize() const | 141 float FontDescription::effectiveFontSize() const |
120 { | 142 { |
121 float size = (RuntimeEnabledFeatures::subpixelFontScalingEnabled()) | 143 float size = (RuntimeEnabledFeatures::subpixelFontScalingEnabled()) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 220 |
199 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 221 if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
200 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate | 222 || historicalLigaturesState() == FontDescription::EnabledLigaturesSt
ate |
201 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { | 223 || contextualLigaturesState() == FontDescription::EnabledLigaturesSt
ate) { |
202 m_typesettingFeatures |= blink::Ligatures; | 224 m_typesettingFeatures |= blink::Ligatures; |
203 } | 225 } |
204 } | 226 } |
205 } | 227 } |
206 | 228 |
207 } // namespace blink | 229 } // namespace blink |
OLD | NEW |