Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: Source/platform/fonts/FontDescription.h

Issue 924903002: Don't allocate Strings in FontDescription(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/resolver/FontBuilder.cpp ('k') | Source/platform/fonts/FontDescription.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class PLATFORM_EXPORT FontDescription { 48 class PLATFORM_EXPORT FontDescription {
49 public: 49 public:
50 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFam ily, 50 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFam ily,
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_specifiedSize(0)
59 , m_specifiedSize(0)
60 , m_computedSize(0) 59 , m_computedSize(0)
61 , m_letterSpacing(0) 60 , m_letterSpacing(0)
62 , m_wordSpacing(0) 61 , m_wordSpacing(0)
63 , m_orientation(Horizontal) 62 , m_orientation(Horizontal)
64 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) 63 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight)
65 , m_widthVariant(RegularWidth) 64 , m_widthVariant(RegularWidth)
66 , m_style(FontStyleNormal) 65 , m_style(FontStyleNormal)
67 , m_variant(FontVariantNormal) 66 , m_variant(FontVariantNormal)
68 , m_isAbsoluteSize(false) 67 , m_isAbsoluteSize(false)
69 , m_weight(FontWeightNormal) 68 , m_weight(FontWeightNormal)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } 153 Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
155 VariantLigatures variantLigatures() const; 154 VariantLigatures variantLigatures() const;
156 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); } 155 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); }
157 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); } 156 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); }
158 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); } 157 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); }
159 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); } 158 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); }
160 unsigned keywordSize() const { return m_keywordSize; } 159 unsigned keywordSize() const { return m_keywordSize; }
161 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); } 160 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); }
162 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); } 161 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); }
163 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } 162 UScriptCode script() const { return static_cast<UScriptCode>(m_script); }
164 const String& locale() const { return m_locale; } 163 const AtomicString& locale() const;
165 bool isSyntheticBold() const { return m_syntheticBold; } 164 bool isSyntheticBold() const { return m_syntheticBold; }
166 bool isSyntheticItalic() const { return m_syntheticItalic; } 165 bool isSyntheticItalic() const { return m_syntheticItalic; }
167 bool useSubpixelPositioning() const { return m_subpixelTextPosition; } 166 bool useSubpixelPositioning() const { return m_subpixelTextPosition; }
168 167
169 FontTraits traits() const; 168 FontTraits traits() const;
170 float wordSpacing() const { return m_wordSpacing; } 169 float wordSpacing() const { return m_wordSpacing; }
171 float letterSpacing() const { return m_letterSpacing; } 170 float letterSpacing() const { return m_letterSpacing; }
172 FontOrientation orientation() const { return static_cast<FontOrientation>(m_ orientation); } 171 FontOrientation orientation() const { return static_cast<FontOrientation>(m_ orientation); }
173 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } 172 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); }
174 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant> (m_widthVariant); } 173 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant> (m_widthVariant); }
(...skipping 13 matching lines...) Expand all
188 void setStretch(FontStretch s) { m_stretch = s; } 187 void setStretch(FontStretch s) { m_stretch = s; }
189 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g enericFamily; } 188 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g enericFamily; }
190 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea tures(); } 189 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea tures(); }
191 void setKeywordSize(unsigned s) { m_keywordSize = s; } 190 void setKeywordSize(unsigned s) { m_keywordSize = s; }
192 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; } 191 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; }
193 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); } 192 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); }
194 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } 193 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; }
195 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; } 194 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; }
196 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; } 195 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; }
197 void setScript(UScriptCode s) { m_script = s; } 196 void setScript(UScriptCode s) { m_script = s; }
198 void setLocale(const String& locale) { m_locale = locale; } 197 void setLocale(const AtomicString& locale) { m_locale = locale; }
199 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } 198 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; }
200 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } 199 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; }
201 void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featur eSettings = settings; } 200 void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featur eSettings = settings; }
202 void setTraits(FontTraits); 201 void setTraits(FontTraits);
203 void setWordSpacing(float s) { m_wordSpacing = s; } 202 void setWordSpacing(float s) { m_wordSpacing = s; }
204 void setLetterSpacing(float s) { m_letterSpacing = s; updateTypesettingFeatu res(); } 203 void setLetterSpacing(float s) { m_letterSpacing = s; updateTypesettingFeatu res(); }
205 204
206 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); } 205 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); }
207 206
208 static void setSubpixelPositioning(bool b) { s_useSubpixelTextPositioning = b; } 207 static void setSubpixelPositioning(bool b) { s_useSubpixelTextPositioning = b; }
209 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; } 208 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; }
210 209
211 static void setDefaultTypesettingFeatures(TypesettingFeatures); 210 static void setDefaultTypesettingFeatures(TypesettingFeatures);
212 static TypesettingFeatures defaultTypesettingFeatures(); 211 static TypesettingFeatures defaultTypesettingFeatures();
213 212
214 private: 213 private:
215 FontFamily m_familyList; // The list of font families to be used. 214 FontFamily m_familyList; // The list of font families to be used.
216 RefPtr<FontFeatureSettings> m_featureSettings; 215 RefPtr<FontFeatureSettings> m_featureSettings;
217 String m_locale; 216 AtomicString m_locale;
218 217
219 void updateTypesettingFeatures() const; 218 void updateTypesettingFeatures() const;
220 219
221 float m_specifiedSize; // Specified CSS value. Independent of rendering is sues such as integer 220 float m_specifiedSize; // Specified CSS value. Independent of rendering is sues such as integer
222 // rounding, minimum font sizes, and zooming. 221 // rounding, minimum font sizes, and zooming.
223 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor. 222 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor.
224 223
225 float m_letterSpacing; 224 float m_letterSpacing;
226 float m_wordSpacing; 225 float m_wordSpacing;
227 226
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 && m_script == other.m_script 289 && m_script == other.m_script
291 && m_syntheticBold == other.m_syntheticBold 290 && m_syntheticBold == other.m_syntheticBold
292 && m_syntheticItalic == other.m_syntheticItalic 291 && m_syntheticItalic == other.m_syntheticItalic
293 && m_featureSettings == other.m_featureSettings 292 && m_featureSettings == other.m_featureSettings
294 && m_subpixelTextPosition == other.m_subpixelTextPosition; 293 && m_subpixelTextPosition == other.m_subpixelTextPosition;
295 } 294 }
296 295
297 } // namespace blink 296 } // namespace blink
298 297
299 #endif 298 #endif
OLDNEW
« no previous file with comments | « Source/core/css/resolver/FontBuilder.cpp ('k') | Source/platform/fonts/FontDescription.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698