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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 , contextual(NormalLigaturesState) | 96 , contextual(NormalLigaturesState) |
97 { | 97 { |
98 } | 98 } |
99 | 99 |
100 unsigned common : 2; | 100 unsigned common : 2; |
101 unsigned discretionary : 2; | 101 unsigned discretionary : 2; |
102 unsigned historical : 2; | 102 unsigned historical : 2; |
103 unsigned contextual : 2; | 103 unsigned contextual : 2; |
104 }; | 104 }; |
105 | 105 |
| 106 struct Size { |
| 107 Size(unsigned keyword, float value, bool isAbsolute) |
| 108 : keyword(keyword) |
| 109 , isAbsolute(isAbsolute) |
| 110 , value(value) |
| 111 { |
| 112 } |
| 113 unsigned keyword : 4; // FontDescription::keywordSize |
| 114 unsigned isAbsolute : 1; // FontDescription::isAbsoluteSize |
| 115 float value; |
| 116 }; |
| 117 |
106 const FontFamily& family() const { return m_familyList; } | 118 const FontFamily& family() const { return m_familyList; } |
107 FontFamily& firstFamily() { return m_familyList; } | 119 FontFamily& firstFamily() { return m_familyList; } |
| 120 Size size() const { return Size(m_keywordSize, m_specifiedSize, m_isAbsolute
Size); } |
108 float specifiedSize() const { return m_specifiedSize; } | 121 float specifiedSize() const { return m_specifiedSize; } |
109 float computedSize() const { return m_computedSize; } | 122 float computedSize() const { return m_computedSize; } |
110 FontStyle style() const { return static_cast<FontStyle>(m_style); } | 123 FontStyle style() const { return static_cast<FontStyle>(m_style); } |
111 int computedPixelSize() const { return int(m_computedSize + 0.5f); } | 124 int computedPixelSize() const { return int(m_computedSize + 0.5f); } |
112 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } | 125 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } |
113 bool isAbsoluteSize() const { return m_isAbsoluteSize; } | 126 bool isAbsoluteSize() const { return m_isAbsoluteSize; } |
114 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } | 127 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } |
115 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } | 128 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } |
116 static FontWeight lighterWeight(FontWeight); | 129 static FontWeight lighterWeight(FontWeight); |
117 static FontWeight bolderWeight(FontWeight); | 130 static FontWeight bolderWeight(FontWeight); |
| 131 static Size largerSize(const Size&); |
| 132 static Size smallerSize(const Size&); |
118 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy
pe>(m_genericFamily); } | 133 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy
pe>(m_genericFamily); } |
119 | 134 |
120 // only use fixed default size when there is only one font family, and that
family is "monospace" | 135 // only use fixed default size when there is only one font family, and that
family is "monospace" |
121 FixedPitchFontType fixedPitchFontType() const | 136 FixedPitchFontType fixedPitchFontType() const |
122 { | 137 { |
123 if (genericFamily() == MonospaceFamily && !family().next() && family().f
amily() == FontFamilyNames::webkit_monospace) | 138 if (genericFamily() == MonospaceFamily && !family().next() && family().f
amily() == FontFamilyNames::webkit_monospace) |
124 return FixedPitchFont; | 139 return FixedPitchFont; |
125 return NonFixedPitchFont; | 140 return NonFixedPitchFont; |
126 } | 141 } |
127 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } | 142 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 && m_script == other.m_script | 278 && m_script == other.m_script |
264 && m_syntheticBold == other.m_syntheticBold | 279 && m_syntheticBold == other.m_syntheticBold |
265 && m_syntheticItalic == other.m_syntheticItalic | 280 && m_syntheticItalic == other.m_syntheticItalic |
266 && m_featureSettings == other.m_featureSettings | 281 && m_featureSettings == other.m_featureSettings |
267 && m_subpixelTextPosition == other.m_subpixelTextPosition; | 282 && m_subpixelTextPosition == other.m_subpixelTextPosition; |
268 } | 283 } |
269 | 284 |
270 } | 285 } |
271 | 286 |
272 #endif | 287 #endif |
OLD | NEW |