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, USm_ |
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 "FontFamilyNames.h" | 28 #include "FontFamilyNames.h" |
29 #include "hb.h" | |
29 #include "platform/fonts/FontCacheKey.h" | 30 #include "platform/fonts/FontCacheKey.h" |
30 #include "platform/fonts/FontFamily.h" | 31 #include "platform/fonts/FontFamily.h" |
31 #include "platform/fonts/FontFeatureSettings.h" | 32 #include "platform/fonts/FontFeatureSettings.h" |
32 #include "platform/fonts/FontOrientation.h" | 33 #include "platform/fonts/FontOrientation.h" |
33 #include "platform/fonts/FontSmoothingMode.h" | 34 #include "platform/fonts/FontSmoothingMode.h" |
34 #include "platform/fonts/FontTraits.h" | 35 #include "platform/fonts/FontTraits.h" |
35 #include "platform/fonts/FontWidthVariant.h" | 36 #include "platform/fonts/FontWidthVariant.h" |
36 #include "platform/fonts/TextRenderingMode.h" | 37 #include "platform/fonts/TextRenderingMode.h" |
37 #include "platform/fonts/TypesettingFeatures.h" | 38 #include "platform/fonts/TypesettingFeatures.h" |
38 #include "platform/text/NonCJKGlyphOrientation.h" | 39 #include "platform/text/NonCJKGlyphOrientation.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 , m_historicalLigaturesState(NormalLigaturesState) | 75 , m_historicalLigaturesState(NormalLigaturesState) |
75 , m_contextualLigaturesState(NormalLigaturesState) | 76 , m_contextualLigaturesState(NormalLigaturesState) |
76 , m_keywordSize(0) | 77 , m_keywordSize(0) |
77 , m_fontSmoothing(AutoSmoothing) | 78 , m_fontSmoothing(AutoSmoothing) |
78 , m_textRendering(AutoTextRendering) | 79 , m_textRendering(AutoTextRendering) |
79 , m_script(USCRIPT_COMMON) | 80 , m_script(USCRIPT_COMMON) |
80 , m_syntheticBold(false) | 81 , m_syntheticBold(false) |
81 , m_syntheticItalic(false) | 82 , m_syntheticItalic(false) |
82 , m_subpixelTextPosition(s_useSubpixelTextPositioning) | 83 , m_subpixelTextPosition(s_useSubpixelTextPositioning) |
83 , m_typesettingFeatures(s_defaultTypesettingFeatures) | 84 , m_typesettingFeatures(s_defaultTypesettingFeatures) |
85 , m_locale(hb_language_get_default()) | |
84 { | 86 { |
85 } | 87 } |
86 | 88 |
87 bool operator==(const FontDescription&) const; | 89 bool operator==(const FontDescription&) const; |
88 bool operator!=(const FontDescription& other) const { return !(*this == othe r); } | 90 bool operator!=(const FontDescription& other) const { return !(*this == othe r); } |
89 | 91 |
90 const FontFamily& family() const { return m_familyList; } | 92 const FontFamily& family() const { return m_familyList; } |
91 FontFamily& firstFamily() { return m_familyList; } | 93 FontFamily& firstFamily() { return m_familyList; } |
92 float specifiedSize() const { return m_specifiedSize; } | 94 float specifiedSize() const { return m_specifiedSize; } |
93 float computedSize() const { return m_computedSize; } | 95 float computedSize() const { return m_computedSize; } |
(...skipping 15 matching lines...) Expand all Loading... | |
109 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == FontFamilyNames::webkit_monospace; } | 111 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == FontFamilyNames::webkit_monospace; } |
110 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } | 112 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } |
111 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); } | 113 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); } |
112 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); } | 114 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); } |
113 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); } | 115 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); } |
114 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); } | 116 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); } |
115 unsigned keywordSize() const { return m_keywordSize; } | 117 unsigned keywordSize() const { return m_keywordSize; } |
116 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); } | 118 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); } |
117 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); } | 119 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); } |
118 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } | 120 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } |
121 const hb_language_t locale() const { return m_locale; } | |
Inactive
2014/05/22 13:52:02
Not sure this needs to return a const.
| |
119 bool isSyntheticBold() const { return m_syntheticBold; } | 122 bool isSyntheticBold() const { return m_syntheticBold; } |
120 bool isSyntheticItalic() const { return m_syntheticItalic; } | 123 bool isSyntheticItalic() const { return m_syntheticItalic; } |
121 bool useSubpixelPositioning() const { return m_subpixelTextPosition; } | 124 bool useSubpixelPositioning() const { return m_subpixelTextPosition; } |
122 | 125 |
123 FontTraits traits() const; | 126 FontTraits traits() const; |
124 float wordSpacing() const { return m_wordSpacing; } | 127 float wordSpacing() const { return m_wordSpacing; } |
125 float letterSpacing() const { return m_letterSpacing; } | 128 float letterSpacing() const { return m_letterSpacing; } |
126 FontOrientation orientation() const { return static_cast<FontOrientation>(m_ orientation); } | 129 FontOrientation orientation() const { return static_cast<FontOrientation>(m_ orientation); } |
127 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } | 130 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } |
128 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant> (m_widthVariant); } | 131 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant> (m_widthVariant); } |
(...skipping 18 matching lines...) Expand all Loading... | |
147 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta te) { m_discretionaryLigaturesState = discretionaryLigaturesState; updateTypeset tingFeatures(); } | 150 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta te) { m_discretionaryLigaturesState = discretionaryLigaturesState; updateTypeset tingFeatures(); } |
148 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; updateTypesettingFeatures (); } | 151 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; updateTypesettingFeatures (); } |
149 void setContextualLigaturesState(LigaturesState contextualLigaturesState) { m_contextualLigaturesState = contextualLigaturesState; updateTypesettingFeatures (); } | 152 void setContextualLigaturesState(LigaturesState contextualLigaturesState) { m_contextualLigaturesState = contextualLigaturesState; updateTypesettingFeatures (); } |
150 void setKeywordSize(unsigned s) { m_keywordSize = s; } | 153 void setKeywordSize(unsigned s) { m_keywordSize = s; } |
151 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; } | 154 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; } |
152 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); } | 155 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); } |
153 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } | 156 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } |
154 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; } | 157 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; } |
155 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; } | 158 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; } |
156 void setScript(UScriptCode s) { m_script = s; } | 159 void setScript(UScriptCode s) { m_script = s; } |
160 void setLocale(String localeStr) { m_locale = hb_language_from_string((const char*)(static_cast<const LChar *>(localeStr.characters8())), localeStr.length() ); } | |
Inactive
2014/05/22 13:52:02
- Please pass the String argument by const referen
| |
157 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } | 161 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } |
158 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } | 162 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } |
159 void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featur eSettings = settings; } | 163 void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featur eSettings = settings; } |
160 void setTraits(FontTraits); | 164 void setTraits(FontTraits); |
161 void setWordSpacing(float s) { m_wordSpacing = s; } | 165 void setWordSpacing(float s) { m_wordSpacing = s; } |
162 void setLetterSpacing(float s) { m_letterSpacing = s; } | 166 void setLetterSpacing(float s) { m_letterSpacing = s; } |
163 | 167 |
164 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); } | 168 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); } |
165 | 169 |
166 static void setSubpixelPositioning(bool b) { s_useSubpixelTextPositioning = b; } | 170 static void setSubpixelPositioning(bool b) { s_useSubpixelTextPositioning = b; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 unsigned m_script : 7; // Used to help choose an appropriate font for generi c font families. | 216 unsigned m_script : 7; // Used to help choose an appropriate font for generi c font families. |
213 unsigned m_syntheticBold : 1; | 217 unsigned m_syntheticBold : 1; |
214 unsigned m_syntheticItalic : 1; | 218 unsigned m_syntheticItalic : 1; |
215 unsigned m_subpixelTextPosition : 1; | 219 unsigned m_subpixelTextPosition : 1; |
216 | 220 |
217 mutable unsigned m_typesettingFeatures : 2; // TypesettingFeatures | 221 mutable unsigned m_typesettingFeatures : 2; // TypesettingFeatures |
218 | 222 |
219 static TypesettingFeatures s_defaultTypesettingFeatures; | 223 static TypesettingFeatures s_defaultTypesettingFeatures; |
220 | 224 |
221 static bool s_useSubpixelTextPositioning; | 225 static bool s_useSubpixelTextPositioning; |
226 hb_language_t m_locale; | |
Inactive
2014/05/22 13:52:02
It looks like hb_language_t is a typedef to a poin
| |
222 }; | 227 }; |
223 | 228 |
224 inline bool FontDescription::operator==(const FontDescription& other) const | 229 inline bool FontDescription::operator==(const FontDescription& other) const |
225 { | 230 { |
226 return m_familyList == other.m_familyList | 231 return m_familyList == other.m_familyList |
227 && m_specifiedSize == other.m_specifiedSize | 232 && m_specifiedSize == other.m_specifiedSize |
228 && m_computedSize == other.m_computedSize | 233 && m_computedSize == other.m_computedSize |
229 && m_letterSpacing == other.m_letterSpacing | 234 && m_letterSpacing == other.m_letterSpacing |
230 && m_wordSpacing == other.m_wordSpacing | 235 && m_wordSpacing == other.m_wordSpacing |
231 && m_style == other.m_style | 236 && m_style == other.m_style |
(...skipping 17 matching lines...) Expand all Loading... | |
249 && m_script == other.m_script | 254 && m_script == other.m_script |
250 && m_syntheticBold == other.m_syntheticBold | 255 && m_syntheticBold == other.m_syntheticBold |
251 && m_syntheticItalic == other.m_syntheticItalic | 256 && m_syntheticItalic == other.m_syntheticItalic |
252 && m_featureSettings == other.m_featureSettings | 257 && m_featureSettings == other.m_featureSettings |
253 && m_subpixelTextPosition == other.m_subpixelTextPosition; | 258 && m_subpixelTextPosition == other.m_subpixelTextPosition; |
254 } | 259 } |
255 | 260 |
256 } | 261 } |
257 | 262 |
258 #endif | 263 #endif |
OLD | NEW |