| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 FontWeight400, | 49 FontWeight400, |
| 50 FontWeight500, | 50 FontWeight500, |
| 51 FontWeight600, | 51 FontWeight600, |
| 52 FontWeight700, | 52 FontWeight700, |
| 53 FontWeight800, | 53 FontWeight800, |
| 54 FontWeight900, | 54 FontWeight900, |
| 55 FontWeightNormal = FontWeight400, | 55 FontWeightNormal = FontWeight400, |
| 56 FontWeightBold = FontWeight700 | 56 FontWeightBold = FontWeight700 |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Numeric values matching OS/2 & Windows Metrics usWidthClass table. |
| 60 // https://www.microsoft.com/typography/otspec/os2.htm |
| 61 enum FontStretch { |
| 62 FontStretchUltraCondensed = 1, |
| 63 FontStretchExtraCondensed = 2, |
| 64 FontStretchCondensed = 3, |
| 65 FontStretchSemiCondensed = 4, |
| 66 FontStretchNormal = 5, |
| 67 FontStretchSemiExpanded = 6, |
| 68 FontStretchExpanded = 7, |
| 69 FontStretchExtraExpanded = 8, |
| 70 FontStretchUltraExpanded = 9 |
| 71 }; |
| 72 |
| 59 enum FontItalic { | 73 enum FontItalic { |
| 60 FontItalicOff = 0, | 74 FontItalicOff = 0, |
| 61 FontItalicOn = 1 | 75 FontItalicOn = 1 |
| 62 }; | 76 }; |
| 63 | 77 |
| 64 enum FontSmallCaps { | 78 enum FontSmallCaps { |
| 65 FontSmallCapsOff = 0, | 79 FontSmallCapsOff = 0, |
| 66 FontSmallCapsOn = 1 | 80 FontSmallCapsOn = 1 |
| 67 }; | 81 }; |
| 68 | 82 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 , m_computedSize(0) | 94 , m_computedSize(0) |
| 81 , m_letterSpacing(0) | 95 , m_letterSpacing(0) |
| 82 , m_wordSpacing(0) | 96 , m_wordSpacing(0) |
| 83 , m_orientation(Horizontal) | 97 , m_orientation(Horizontal) |
| 84 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) | 98 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) |
| 85 , m_widthVariant(RegularWidth) | 99 , m_widthVariant(RegularWidth) |
| 86 , m_italic(FontItalicOff) | 100 , m_italic(FontItalicOff) |
| 87 , m_smallCaps(FontSmallCapsOff) | 101 , m_smallCaps(FontSmallCapsOff) |
| 88 , m_isAbsoluteSize(false) | 102 , m_isAbsoluteSize(false) |
| 89 , m_weight(FontWeightNormal) | 103 , m_weight(FontWeightNormal) |
| 104 , m_stretch(FontStretchNormal) |
| 90 , m_genericFamily(NoFamily) | 105 , m_genericFamily(NoFamily) |
| 91 , m_usePrinterFont(false) | 106 , m_usePrinterFont(false) |
| 92 , m_kerning(AutoKerning) | 107 , m_kerning(AutoKerning) |
| 93 , m_commonLigaturesState(NormalLigaturesState) | 108 , m_commonLigaturesState(NormalLigaturesState) |
| 94 , m_discretionaryLigaturesState(NormalLigaturesState) | 109 , m_discretionaryLigaturesState(NormalLigaturesState) |
| 95 , m_historicalLigaturesState(NormalLigaturesState) | 110 , m_historicalLigaturesState(NormalLigaturesState) |
| 96 , m_keywordSize(0) | 111 , m_keywordSize(0) |
| 97 , m_fontSmoothing(AutoSmoothing) | 112 , m_fontSmoothing(AutoSmoothing) |
| 98 , m_textRendering(AutoTextRendering) | 113 , m_textRendering(AutoTextRendering) |
| 99 , m_isSpecifiedFont(false) | 114 , m_isSpecifiedFont(false) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 110 | 125 |
| 111 const FontFamily& family() const { return m_familyList; } | 126 const FontFamily& family() const { return m_familyList; } |
| 112 FontFamily& firstFamily() { return m_familyList; } | 127 FontFamily& firstFamily() { return m_familyList; } |
| 113 float specifiedSize() const { return m_specifiedSize; } | 128 float specifiedSize() const { return m_specifiedSize; } |
| 114 float computedSize() const { return m_computedSize; } | 129 float computedSize() const { return m_computedSize; } |
| 115 FontItalic italic() const { return static_cast<FontItalic>(m_italic); } | 130 FontItalic italic() const { return static_cast<FontItalic>(m_italic); } |
| 116 int computedPixelSize() const { return int(m_computedSize + 0.5f); } | 131 int computedPixelSize() const { return int(m_computedSize + 0.5f); } |
| 117 FontSmallCaps smallCaps() const { return static_cast<FontSmallCaps>(m_smallC
aps); } | 132 FontSmallCaps smallCaps() const { return static_cast<FontSmallCaps>(m_smallC
aps); } |
| 118 bool isAbsoluteSize() const { return m_isAbsoluteSize; } | 133 bool isAbsoluteSize() const { return m_isAbsoluteSize; } |
| 119 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } | 134 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } |
| 135 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } |
| 120 FontWeight lighterWeight() const; | 136 FontWeight lighterWeight() const; |
| 121 FontWeight bolderWeight() const; | 137 FontWeight bolderWeight() const; |
| 122 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy
pe>(m_genericFamily); } | 138 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy
pe>(m_genericFamily); } |
| 123 #if OS(MACOSX) | 139 #if OS(MACOSX) |
| 124 bool usePrinterFont() const { return false; } | 140 bool usePrinterFont() const { return false; } |
| 125 #else | 141 #else |
| 126 bool usePrinterFont() const { return m_usePrinterFont; } | 142 bool usePrinterFont() const { return m_usePrinterFont; } |
| 127 #endif | 143 #endif |
| 128 // only use fixed default size when there is only one font family, and that
family is "monospace" | 144 // only use fixed default size when there is only one font family, and that
family is "monospace" |
| 129 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily
&& !family().next() && family().family() == FontFamilyNames::webkit_monospace;
} | 145 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily
&& !family().next() && family().family() == FontFamilyNames::webkit_monospace;
} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 154 | 170 |
| 155 void setFamily(const FontFamily& family) { m_familyList = family; } | 171 void setFamily(const FontFamily& family) { m_familyList = family; } |
| 156 void setComputedSize(float s) { m_computedSize = clampToFloat(s); } | 172 void setComputedSize(float s) { m_computedSize = clampToFloat(s); } |
| 157 void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); } | 173 void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); } |
| 158 void setItalic(FontItalic i) { m_italic = i; } | 174 void setItalic(FontItalic i) { m_italic = i; } |
| 159 void setItalic(bool i) { setItalic(i ? FontItalicOn : FontItalicOff); } | 175 void setItalic(bool i) { setItalic(i ? FontItalicOn : FontItalicOff); } |
| 160 void setSmallCaps(FontSmallCaps c) { m_smallCaps = c; } | 176 void setSmallCaps(FontSmallCaps c) { m_smallCaps = c; } |
| 161 void setSmallCaps(bool c) { setSmallCaps(c ? FontSmallCapsOn : FontSmallCaps
Off); } | 177 void setSmallCaps(bool c) { setSmallCaps(c ? FontSmallCapsOn : FontSmallCaps
Off); } |
| 162 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } | 178 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } |
| 163 void setWeight(FontWeight w) { m_weight = w; } | 179 void setWeight(FontWeight w) { m_weight = w; } |
| 180 void setStretch(FontStretch s) { m_stretch = s; } |
| 164 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g
enericFamily; } | 181 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g
enericFamily; } |
| 165 void setUsePrinterFont(bool p) { m_usePrinterFont = p; } | 182 void setUsePrinterFont(bool p) { m_usePrinterFont = p; } |
| 166 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea
tures(); } | 183 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea
tures(); } |
| 167 void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_common
LigaturesState = commonLigaturesState; updateTypesettingFeatures(); } | 184 void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_common
LigaturesState = commonLigaturesState; updateTypesettingFeatures(); } |
| 168 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta
te) { m_discretionaryLigaturesState = discretionaryLigaturesState; } | 185 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta
te) { m_discretionaryLigaturesState = discretionaryLigaturesState; } |
| 169 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) {
m_historicalLigaturesState = historicalLigaturesState; } | 186 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) {
m_historicalLigaturesState = historicalLigaturesState; } |
| 170 void setKeywordSize(unsigned s) { m_keywordSize = s; } | 187 void setKeywordSize(unsigned s) { m_keywordSize = s; } |
| 171 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot
hing; } | 188 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot
hing; } |
| 172 void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = r
endering; updateTypesettingFeatures(); } | 189 void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = r
endering; updateTypesettingFeatures(); } |
| 173 void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecif
iedFont; } | 190 void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecif
iedFont; } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 unsigned m_orientation : 1; // FontOrientation - Whether the font is renderi
ng on a horizontal line or a vertical line. | 223 unsigned m_orientation : 1; // FontOrientation - Whether the font is renderi
ng on a horizontal line or a vertical line. |
| 207 unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used
by vertical text. Determines the default orientation for non-ideograph glyphs. | 224 unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used
by vertical text. Determines the default orientation for non-ideograph glyphs. |
| 208 | 225 |
| 209 unsigned m_widthVariant : 2; // FontWidthVariant | 226 unsigned m_widthVariant : 2; // FontWidthVariant |
| 210 | 227 |
| 211 unsigned m_italic : 1; // FontItalic | 228 unsigned m_italic : 1; // FontItalic |
| 212 unsigned m_smallCaps : 1; // FontSmallCaps | 229 unsigned m_smallCaps : 1; // FontSmallCaps |
| 213 unsigned m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit s
ize | 230 unsigned m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit s
ize |
| 214 // (logical sizes like "medium" don't count). | 231 // (logical sizes like "medium" don't count). |
| 215 unsigned m_weight : 8; // FontWeight | 232 unsigned m_weight : 8; // FontWeight |
| 233 unsigned m_stretch : 4; // FontStretch |
| 216 unsigned m_genericFamily : 3; // GenericFamilyType | 234 unsigned m_genericFamily : 3; // GenericFamilyType |
| 217 unsigned m_usePrinterFont : 1; | 235 unsigned m_usePrinterFont : 1; |
| 218 | 236 |
| 219 unsigned m_kerning : 2; // Kerning | 237 unsigned m_kerning : 2; // Kerning |
| 220 | 238 |
| 221 unsigned m_commonLigaturesState : 2; | 239 unsigned m_commonLigaturesState : 2; |
| 222 unsigned m_discretionaryLigaturesState : 2; | 240 unsigned m_discretionaryLigaturesState : 2; |
| 223 unsigned m_historicalLigaturesState : 2; | 241 unsigned m_historicalLigaturesState : 2; |
| 224 | 242 |
| 225 unsigned m_keywordSize : 4; // We cache whether or not a font is currently r
epresented by a CSS keyword (e.g., medium). If so, | 243 unsigned m_keywordSize : 4; // We cache whether or not a font is currently r
epresented by a CSS keyword (e.g., medium). If so, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 245 { | 263 { |
| 246 return m_familyList == other.m_familyList | 264 return m_familyList == other.m_familyList |
| 247 && m_specifiedSize == other.m_specifiedSize | 265 && m_specifiedSize == other.m_specifiedSize |
| 248 && m_computedSize == other.m_computedSize | 266 && m_computedSize == other.m_computedSize |
| 249 && m_letterSpacing == other.m_letterSpacing | 267 && m_letterSpacing == other.m_letterSpacing |
| 250 && m_wordSpacing == other.m_wordSpacing | 268 && m_wordSpacing == other.m_wordSpacing |
| 251 && m_italic == other.m_italic | 269 && m_italic == other.m_italic |
| 252 && m_smallCaps == other.m_smallCaps | 270 && m_smallCaps == other.m_smallCaps |
| 253 && m_isAbsoluteSize == other.m_isAbsoluteSize | 271 && m_isAbsoluteSize == other.m_isAbsoluteSize |
| 254 && m_weight == other.m_weight | 272 && m_weight == other.m_weight |
| 273 && m_stretch == other.m_stretch |
| 255 && m_genericFamily == other.m_genericFamily | 274 && m_genericFamily == other.m_genericFamily |
| 256 && m_usePrinterFont == other.m_usePrinterFont | 275 && m_usePrinterFont == other.m_usePrinterFont |
| 257 && m_kerning == other.m_kerning | 276 && m_kerning == other.m_kerning |
| 258 && m_commonLigaturesState == other.m_commonLigaturesState | 277 && m_commonLigaturesState == other.m_commonLigaturesState |
| 259 && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState | 278 && m_discretionaryLigaturesState == other.m_discretionaryLigaturesState |
| 260 && m_historicalLigaturesState == other.m_historicalLigaturesState | 279 && m_historicalLigaturesState == other.m_historicalLigaturesState |
| 261 && m_keywordSize == other.m_keywordSize | 280 && m_keywordSize == other.m_keywordSize |
| 262 && m_fontSmoothing == other.m_fontSmoothing | 281 && m_fontSmoothing == other.m_fontSmoothing |
| 263 && m_textRendering == other.m_textRendering | 282 && m_textRendering == other.m_textRendering |
| 264 && m_isSpecifiedFont == other.m_isSpecifiedFont | 283 && m_isSpecifiedFont == other.m_isSpecifiedFont |
| 265 && m_orientation == other.m_orientation | 284 && m_orientation == other.m_orientation |
| 266 && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation | 285 && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation |
| 267 && m_widthVariant == other.m_widthVariant | 286 && m_widthVariant == other.m_widthVariant |
| 268 && m_script == other.m_script | 287 && m_script == other.m_script |
| 269 && m_syntheticBold == other.m_syntheticBold | 288 && m_syntheticBold == other.m_syntheticBold |
| 270 && m_syntheticItalic == other.m_syntheticItalic | 289 && m_syntheticItalic == other.m_syntheticItalic |
| 271 && m_featureSettings == other.m_featureSettings | 290 && m_featureSettings == other.m_featureSettings |
| 272 && m_subpixelTextPosition == other.m_subpixelTextPosition; | 291 && m_subpixelTextPosition == other.m_subpixelTextPosition; |
| 273 } | 292 } |
| 274 | 293 |
| 275 } | 294 } |
| 276 | 295 |
| 277 #endif | 296 #endif |
| OLD | NEW |