| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 MonospaceFamily, CursiveFamily, FantasyFamily, Pict
ographFamily }; | 51 MonospaceFamily, CursiveFamily, FantasyFamily, Pict
ographFamily }; |
| 52 | 52 |
| 53 enum Kerning { AutoKerning, NormalKerning, NoneKerning }; | 53 enum Kerning { AutoKerning, NormalKerning, NoneKerning }; |
| 54 | 54 |
| 55 enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledL
igaturesState }; | 55 enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledL
igaturesState }; |
| 56 | 56 |
| 57 FontDescription() | 57 FontDescription() |
| 58 : m_locale("en") | 58 : m_locale("en") |
| 59 , m_specifiedSize(0) | 59 , m_specifiedSize(0) |
| 60 , m_computedSize(0) | 60 , m_computedSize(0) |
| 61 , m_adjustedSize(0) |
| 62 , m_sizeAdjust(0) |
| 61 , m_letterSpacing(0) | 63 , m_letterSpacing(0) |
| 62 , m_wordSpacing(0) | 64 , m_wordSpacing(0) |
| 63 , m_orientation(Horizontal) | 65 , m_orientation(Horizontal) |
| 64 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) | 66 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) |
| 65 , m_widthVariant(RegularWidth) | 67 , m_widthVariant(RegularWidth) |
| 66 , m_style(FontStyleNormal) | 68 , m_style(FontStyleNormal) |
| 67 , m_variant(FontVariantNormal) | 69 , m_variant(FontVariantNormal) |
| 68 , m_isAbsoluteSize(false) | 70 , m_isAbsoluteSize(false) |
| 69 , m_weight(FontWeightNormal) | 71 , m_weight(FontWeightNormal) |
| 70 , m_stretch(FontStretchNormal) | 72 , m_stretch(FontStretchNormal) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 GenericFamilyType genericFamily; | 127 GenericFamilyType genericFamily; |
| 126 FontFamily family; | 128 FontFamily family; |
| 127 }; | 129 }; |
| 128 | 130 |
| 129 const FontFamily& family() const { return m_familyList; } | 131 const FontFamily& family() const { return m_familyList; } |
| 130 FamilyDescription familyDescription() const { return FamilyDescription(gener
icFamily(), family()); } | 132 FamilyDescription familyDescription() const { return FamilyDescription(gener
icFamily(), family()); } |
| 131 FontFamily& firstFamily() { return m_familyList; } | 133 FontFamily& firstFamily() { return m_familyList; } |
| 132 Size size() const { return Size(m_keywordSize, m_specifiedSize, m_isAbsolute
Size); } | 134 Size size() const { return Size(m_keywordSize, m_specifiedSize, m_isAbsolute
Size); } |
| 133 float specifiedSize() const { return m_specifiedSize; } | 135 float specifiedSize() const { return m_specifiedSize; } |
| 134 float computedSize() const { return m_computedSize; } | 136 float computedSize() const { return m_computedSize; } |
| 137 float adjustedSize() const { return m_adjustedSize; } |
| 138 float sizeAdjust() const { return m_sizeAdjust; } |
| 135 FontStyle style() const { return static_cast<FontStyle>(m_style); } | 139 FontStyle style() const { return static_cast<FontStyle>(m_style); } |
| 136 int computedPixelSize() const { return int(m_computedSize + 0.5f); } | 140 int computedPixelSize() const { return int(m_computedSize + 0.5f); } |
| 137 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } | 141 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } |
| 138 bool isAbsoluteSize() const { return m_isAbsoluteSize; } | 142 bool isAbsoluteSize() const { return m_isAbsoluteSize; } |
| 139 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } | 143 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } |
| 140 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } | 144 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } |
| 141 static FontWeight lighterWeight(FontWeight); | 145 static FontWeight lighterWeight(FontWeight); |
| 142 static FontWeight bolderWeight(FontWeight); | 146 static FontWeight bolderWeight(FontWeight); |
| 143 static Size largerSize(const Size&); | 147 static Size largerSize(const Size&); |
| 144 static Size smallerSize(const Size&); | 148 static Size smallerSize(const Size&); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 173 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N
onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } | 177 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N
onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } |
| 174 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant>
(m_widthVariant); } | 178 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant>
(m_widthVariant); } |
| 175 FontFeatureSettings* featureSettings() const { return m_featureSettings.get(
); } | 179 FontFeatureSettings* featureSettings() const { return m_featureSettings.get(
); } |
| 176 | 180 |
| 177 float effectiveFontSize() const; // Returns either the computedSize or the c
omputedPixelSize | 181 float effectiveFontSize() const; // Returns either the computedSize or the c
omputedPixelSize |
| 178 FontCacheKey cacheKey(const FontFaceCreationParams&, FontTraits desiredTrait
s = FontTraits(0)) const; | 182 FontCacheKey cacheKey(const FontFaceCreationParams&, FontTraits desiredTrait
s = FontTraits(0)) const; |
| 179 | 183 |
| 180 void setFamily(const FontFamily& family) { m_familyList = family; } | 184 void setFamily(const FontFamily& family) { m_familyList = family; } |
| 181 void setComputedSize(float s) { m_computedSize = clampTo<float>(s); } | 185 void setComputedSize(float s) { m_computedSize = clampTo<float>(s); } |
| 182 void setSpecifiedSize(float s) { m_specifiedSize = clampTo<float>(s); } | 186 void setSpecifiedSize(float s) { m_specifiedSize = clampTo<float>(s); } |
| 187 void setAdjustedSize(float s) { m_adjustedSize = clampTo<float>(s); } |
| 188 void setSizeAdjust(float aspect) { m_sizeAdjust = clampTo<float>(aspect); } |
| 183 void setStyle(FontStyle i) { m_style = i; } | 189 void setStyle(FontStyle i) { m_style = i; } |
| 184 void setVariant(FontVariant c) { m_variant = c; } | 190 void setVariant(FontVariant c) { m_variant = c; } |
| 185 void setVariantLigatures(const VariantLigatures&); | 191 void setVariantLigatures(const VariantLigatures&); |
| 186 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } | 192 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } |
| 187 void setWeight(FontWeight w) { m_weight = w; } | 193 void setWeight(FontWeight w) { m_weight = w; } |
| 188 void setStretch(FontStretch s) { m_stretch = s; } | 194 void setStretch(FontStretch s) { m_stretch = s; } |
| 189 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g
enericFamily; } | 195 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g
enericFamily; } |
| 190 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea
tures(); } | 196 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea
tures(); } |
| 191 void setKeywordSize(unsigned s) { m_keywordSize = s; } | 197 void setKeywordSize(unsigned s) { m_keywordSize = s; } |
| 192 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot
hing; } | 198 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot
hing; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 215 FontFamily m_familyList; // The list of font families to be used. | 221 FontFamily m_familyList; // The list of font families to be used. |
| 216 RefPtr<FontFeatureSettings> m_featureSettings; | 222 RefPtr<FontFeatureSettings> m_featureSettings; |
| 217 String m_locale; | 223 String m_locale; |
| 218 | 224 |
| 219 void updateTypesettingFeatures() const; | 225 void updateTypesettingFeatures() const; |
| 220 | 226 |
| 221 float m_specifiedSize; // Specified CSS value. Independent of rendering is
sues such as integer | 227 float m_specifiedSize; // Specified CSS value. Independent of rendering is
sues such as integer |
| 222 // rounding, minimum font sizes, and zooming. | 228 // rounding, minimum font sizes, and zooming. |
| 223 float m_computedSize; // Computed size adjusted for the minimum font size
and the zoom factor. | 229 float m_computedSize; // Computed size adjusted for the minimum font size
and the zoom factor. |
| 224 | 230 |
| 231 float m_adjustedSize; // (Given aspect value / aspect value of a font family
) * specifiedSize. |
| 232 // This value is adjusted for the minimum font size and the zoom factor |
| 233 // as well as a computed size is. |
| 234 float m_sizeAdjust; // Given aspect value, i.e. font-size-adjust. |
| 235 |
| 225 float m_letterSpacing; | 236 float m_letterSpacing; |
| 226 float m_wordSpacing; | 237 float m_wordSpacing; |
| 227 | 238 |
| 228 unsigned m_orientation : 1; // FontOrientation - Whether the font is renderi
ng on a horizontal line or a vertical line. | 239 unsigned m_orientation : 1; // FontOrientation - Whether the font is renderi
ng on a horizontal line or a vertical line. |
| 229 unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used
by vertical text. Determines the default orientation for non-ideograph glyphs. | 240 unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used
by vertical text. Determines the default orientation for non-ideograph glyphs. |
| 230 | 241 |
| 231 unsigned m_widthVariant : 2; // FontWidthVariant | 242 unsigned m_widthVariant : 2; // FontWidthVariant |
| 232 | 243 |
| 233 unsigned m_style : 1; // FontStyle | 244 unsigned m_style : 1; // FontStyle |
| 234 unsigned m_variant : 1; // FontVariant | 245 unsigned m_variant : 1; // FontVariant |
| (...skipping 26 matching lines...) Expand all Loading... |
| 261 static TypesettingFeatures s_defaultTypesettingFeatures; | 272 static TypesettingFeatures s_defaultTypesettingFeatures; |
| 262 | 273 |
| 263 static bool s_useSubpixelTextPositioning; | 274 static bool s_useSubpixelTextPositioning; |
| 264 }; | 275 }; |
| 265 | 276 |
| 266 inline bool FontDescription::operator==(const FontDescription& other) const | 277 inline bool FontDescription::operator==(const FontDescription& other) const |
| 267 { | 278 { |
| 268 return m_familyList == other.m_familyList | 279 return m_familyList == other.m_familyList |
| 269 && m_specifiedSize == other.m_specifiedSize | 280 && m_specifiedSize == other.m_specifiedSize |
| 270 && m_computedSize == other.m_computedSize | 281 && m_computedSize == other.m_computedSize |
| 282 && m_adjustedSize == other.m_adjustedSize |
| 283 && m_sizeAdjust == other.m_sizeAdjust |
| 271 && m_letterSpacing == other.m_letterSpacing | 284 && m_letterSpacing == other.m_letterSpacing |
| 272 && m_wordSpacing == other.m_wordSpacing | 285 && m_wordSpacing == other.m_wordSpacing |
| 273 && m_style == other.m_style | 286 && m_style == other.m_style |
| 274 && m_variant == other.m_variant | 287 && m_variant == other.m_variant |
| 275 && m_isAbsoluteSize == other.m_isAbsoluteSize | 288 && m_isAbsoluteSize == other.m_isAbsoluteSize |
| 276 && m_weight == other.m_weight | 289 && m_weight == other.m_weight |
| 277 && m_stretch == other.m_stretch | 290 && m_stretch == other.m_stretch |
| 278 && m_genericFamily == other.m_genericFamily | 291 && m_genericFamily == other.m_genericFamily |
| 279 && m_kerning == other.m_kerning | 292 && m_kerning == other.m_kerning |
| 280 && m_commonLigaturesState == other.m_commonLigaturesState | 293 && m_commonLigaturesState == other.m_commonLigaturesState |
| 281 && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState | 294 && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState |
| 282 && m_historicalLigaturesState == other.m_historicalLigaturesState | 295 && m_historicalLigaturesState == other.m_historicalLigaturesState |
| 283 && m_contextualLigaturesState == other.m_contextualLigaturesState | 296 && m_contextualLigaturesState == other.m_contextualLigaturesState |
| 284 && m_keywordSize == other.m_keywordSize | 297 && m_keywordSize == other.m_keywordSize |
| 285 && m_fontSmoothing == other.m_fontSmoothing | 298 && m_fontSmoothing == other.m_fontSmoothing |
| 286 && m_textRendering == other.m_textRendering | 299 && m_textRendering == other.m_textRendering |
| 287 && m_orientation == other.m_orientation | 300 && m_orientation == other.m_orientation |
| 288 && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation | 301 && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation |
| 289 && m_widthVariant == other.m_widthVariant | 302 && m_widthVariant == other.m_widthVariant |
| 290 && m_script == other.m_script | 303 && m_script == other.m_script |
| 291 && m_syntheticBold == other.m_syntheticBold | 304 && m_syntheticBold == other.m_syntheticBold |
| 292 && m_syntheticItalic == other.m_syntheticItalic | 305 && m_syntheticItalic == other.m_syntheticItalic |
| 293 && m_featureSettings == other.m_featureSettings | 306 && m_featureSettings == other.m_featureSettings |
| 294 && m_subpixelTextPosition == other.m_subpixelTextPosition; | 307 && m_subpixelTextPosition == other.m_subpixelTextPosition; |
| 295 } | 308 } |
| 296 | 309 |
| 297 } // namespace blink | 310 } // namespace blink |
| 298 | 311 |
| 299 #endif | 312 #endif |
| OLD | NEW |