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 |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIother.m_ If not, write to | 19 * along with this library; see the file COPYING.LIother.m_ If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USm_ | 21 * Boston, MA 02110-1301, USA. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #ifndef FontDescription_h | 25 #ifndef FontDescription_h |
26 #define FontDescription_h | 26 #define FontDescription_h |
27 | 27 |
28 #include "platform/FontFamilyNames.h" | 28 #include "platform/FontFamilyNames.h" |
29 #include "platform/fonts/FixedPitchFontType.h" | 29 #include "platform/fonts/FixedPitchFontType.h" |
30 #include "platform/fonts/FontCacheKey.h" | 30 #include "platform/fonts/FontCacheKey.h" |
31 #include "platform/fonts/FontFamily.h" | 31 #include "platform/fonts/FontFamily.h" |
32 #include "platform/fonts/FontFeatureSettings.h" | 32 #include "platform/fonts/FontFeatureSettings.h" |
33 #include "platform/fonts/FontOrientation.h" | 33 #include "platform/fonts/FontOrientation.h" |
34 #include "platform/fonts/FontSmoothingMode.h" | 34 #include "platform/fonts/FontSmoothingMode.h" |
35 #include "platform/fonts/FontTraits.h" | 35 #include "platform/fonts/FontTraits.h" |
36 #include "platform/fonts/FontWidthVariant.h" | 36 #include "platform/fonts/FontWidthVariant.h" |
37 #include "platform/fonts/TextRenderingMode.h" | 37 #include "platform/fonts/TextRenderingMode.h" |
38 #include "platform/fonts/TypesettingFeatures.h" | 38 #include "platform/fonts/TypesettingFeatures.h" |
39 #include "platform/text/NonCJKGlyphOrientation.h" | 39 #include "platform/text/NonCJKGlyphOrientation.h" |
40 #include "wtf/MathExtras.h" | 40 #include "wtf/MathExtras.h" |
41 | 41 |
42 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
43 | 43 |
44 #include <unicode/uscript.h> | 44 #include <unicode/uscript.h> |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
| 48 const float FontSizeAdjustNone = -1; |
| 49 |
48 class PLATFORM_EXPORT FontDescription { | 50 class PLATFORM_EXPORT FontDescription { |
49 public: | 51 public: |
50 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFam
ily, | 52 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFam
ily, |
51 MonospaceFamily, CursiveFamily, FantasyFamily, Pict
ographFamily }; | 53 MonospaceFamily, CursiveFamily, FantasyFamily, Pict
ographFamily }; |
52 | 54 |
53 enum Kerning { AutoKerning, NormalKerning, NoneKerning }; | 55 enum Kerning { AutoKerning, NormalKerning, NoneKerning }; |
54 | 56 |
55 enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledL
igaturesState }; | 57 enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledL
igaturesState }; |
56 | 58 |
57 FontDescription() | 59 FontDescription() |
58 : m_specifiedSize(0) | 60 : m_specifiedSize(0) |
59 , m_computedSize(0) | 61 , m_computedSize(0) |
60 , m_adjustedSize(0) | 62 , m_adjustedSize(0) |
61 , m_sizeAdjust(0) | 63 , m_sizeAdjust(FontSizeAdjustNone) |
62 , m_letterSpacing(0) | 64 , m_letterSpacing(0) |
63 , m_wordSpacing(0) | 65 , m_wordSpacing(0) |
64 , m_orientation(Horizontal) | 66 , m_orientation(Horizontal) |
65 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) | 67 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) |
66 , m_widthVariant(RegularWidth) | 68 , m_widthVariant(RegularWidth) |
67 , m_style(FontStyleNormal) | 69 , m_style(FontStyleNormal) |
68 , m_variant(FontVariantNormal) | 70 , m_variant(FontVariantNormal) |
69 , m_isAbsoluteSize(false) | 71 , m_isAbsoluteSize(false) |
70 , m_weight(FontWeightNormal) | 72 , m_weight(FontWeightNormal) |
71 , m_stretch(FontStretchNormal) | 73 , m_stretch(FontStretchNormal) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 }; | 130 }; |
129 | 131 |
130 const FontFamily& family() const { return m_familyList; } | 132 const FontFamily& family() const { return m_familyList; } |
131 FamilyDescription familyDescription() const { return FamilyDescription(gener
icFamily(), family()); } | 133 FamilyDescription familyDescription() const { return FamilyDescription(gener
icFamily(), family()); } |
132 FontFamily& firstFamily() { return m_familyList; } | 134 FontFamily& firstFamily() { return m_familyList; } |
133 Size size() const { return Size(m_keywordSize, m_specifiedSize, m_isAbsolute
Size); } | 135 Size size() const { return Size(m_keywordSize, m_specifiedSize, m_isAbsolute
Size); } |
134 float specifiedSize() const { return m_specifiedSize; } | 136 float specifiedSize() const { return m_specifiedSize; } |
135 float computedSize() const { return m_computedSize; } | 137 float computedSize() const { return m_computedSize; } |
136 float adjustedSize() const { return m_adjustedSize; } | 138 float adjustedSize() const { return m_adjustedSize; } |
137 float sizeAdjust() const { return m_sizeAdjust; } | 139 float sizeAdjust() const { return m_sizeAdjust; } |
| 140 bool hasSizeAdjust() const { return m_sizeAdjust != FontSizeAdjustNone; } |
138 FontStyle style() const { return static_cast<FontStyle>(m_style); } | 141 FontStyle style() const { return static_cast<FontStyle>(m_style); } |
139 int computedPixelSize() const { return int(m_computedSize + 0.5f); } | 142 int computedPixelSize() const { return int(m_computedSize + 0.5f); } |
140 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } | 143 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } |
141 bool isAbsoluteSize() const { return m_isAbsoluteSize; } | 144 bool isAbsoluteSize() const { return m_isAbsoluteSize; } |
142 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } | 145 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } |
143 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } | 146 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } |
144 static FontWeight lighterWeight(FontWeight); | 147 static FontWeight lighterWeight(FontWeight); |
145 static FontWeight bolderWeight(FontWeight); | 148 static FontWeight bolderWeight(FontWeight); |
146 static Size largerSize(const Size&); | 149 static Size largerSize(const Size&); |
147 static Size smallerSize(const Size&); | 150 static Size smallerSize(const Size&); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 && m_script == other.m_script | 308 && m_script == other.m_script |
306 && m_syntheticBold == other.m_syntheticBold | 309 && m_syntheticBold == other.m_syntheticBold |
307 && m_syntheticItalic == other.m_syntheticItalic | 310 && m_syntheticItalic == other.m_syntheticItalic |
308 && m_featureSettings == other.m_featureSettings | 311 && m_featureSettings == other.m_featureSettings |
309 && m_subpixelTextPosition == other.m_subpixelTextPosition; | 312 && m_subpixelTextPosition == other.m_subpixelTextPosition; |
310 } | 313 } |
311 | 314 |
312 } // namespace blink | 315 } // namespace blink |
313 | 316 |
314 #endif | 317 #endif |
OLD | NEW |