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

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

Issue 276573010: Adding Locale (language attribute) information to font and using the (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating Test Expectation file due to recent commits Created 6 years, 6 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class PLATFORM_EXPORT FontDescription { 47 class PLATFORM_EXPORT FontDescription {
48 public: 48 public:
49 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFam ily, 49 enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFam ily,
50 MonospaceFamily, CursiveFamily, FantasyFamily, Pict ographFamily }; 50 MonospaceFamily, CursiveFamily, FantasyFamily, Pict ographFamily };
51 51
52 enum Kerning { AutoKerning, NormalKerning, NoneKerning }; 52 enum Kerning { AutoKerning, NormalKerning, NoneKerning };
53 53
54 enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledL igaturesState }; 54 enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledL igaturesState };
55 55
56 FontDescription() 56 FontDescription()
57 : m_specifiedSize(0) 57 : m_locale("en")
58 , m_specifiedSize(0)
58 , m_computedSize(0) 59 , m_computedSize(0)
59 , m_letterSpacing(0) 60 , m_letterSpacing(0)
60 , m_wordSpacing(0) 61 , m_wordSpacing(0)
61 , m_orientation(Horizontal) 62 , m_orientation(Horizontal)
62 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight) 63 , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight)
63 , m_widthVariant(RegularWidth) 64 , m_widthVariant(RegularWidth)
64 , m_style(FontStyleNormal) 65 , m_style(FontStyleNormal)
65 , m_variant(FontVariantNormal) 66 , m_variant(FontVariantNormal)
66 , m_isAbsoluteSize(false) 67 , m_isAbsoluteSize(false)
67 , m_weight(FontWeightNormal) 68 , m_weight(FontWeightNormal)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == FontFamilyNames::webkit_monospace; } 105 bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == FontFamilyNames::webkit_monospace; }
105 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } 106 Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
106 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); } 107 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); }
107 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); } 108 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); }
108 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); } 109 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); }
109 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); } 110 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); }
110 unsigned keywordSize() const { return m_keywordSize; } 111 unsigned keywordSize() const { return m_keywordSize; }
111 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); } 112 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); }
112 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); } 113 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); }
113 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } 114 UScriptCode script() const { return static_cast<UScriptCode>(m_script); }
115 const String& locale() const { return m_locale; }
114 bool isSyntheticBold() const { return m_syntheticBold; } 116 bool isSyntheticBold() const { return m_syntheticBold; }
115 bool isSyntheticItalic() const { return m_syntheticItalic; } 117 bool isSyntheticItalic() const { return m_syntheticItalic; }
116 bool useSubpixelPositioning() const { return m_subpixelTextPosition; } 118 bool useSubpixelPositioning() const { return m_subpixelTextPosition; }
117 119
118 FontTraits traits() const; 120 FontTraits traits() const;
119 float wordSpacing() const { return m_wordSpacing; } 121 float wordSpacing() const { return m_wordSpacing; }
120 float letterSpacing() const { return m_letterSpacing; } 122 float letterSpacing() const { return m_letterSpacing; }
121 FontOrientation orientation() const { return static_cast<FontOrientation>(m_ orientation); } 123 FontOrientation orientation() const { return static_cast<FontOrientation>(m_ orientation); }
122 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); } 124 NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<N onCJKGlyphOrientation>(m_nonCJKGlyphOrientation); }
123 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant> (m_widthVariant); } 125 FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant> (m_widthVariant); }
(...skipping 17 matching lines...) Expand all
141 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta te) { m_discretionaryLigaturesState = discretionaryLigaturesState; updateTypeset tingFeatures(); } 143 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta te) { m_discretionaryLigaturesState = discretionaryLigaturesState; updateTypeset tingFeatures(); }
142 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; updateTypesettingFeatures (); } 144 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; updateTypesettingFeatures (); }
143 void setContextualLigaturesState(LigaturesState contextualLigaturesState) { m_contextualLigaturesState = contextualLigaturesState; updateTypesettingFeatures (); } 145 void setContextualLigaturesState(LigaturesState contextualLigaturesState) { m_contextualLigaturesState = contextualLigaturesState; updateTypesettingFeatures (); }
144 void setKeywordSize(unsigned s) { m_keywordSize = s; } 146 void setKeywordSize(unsigned s) { m_keywordSize = s; }
145 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; } 147 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; }
146 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); } 148 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); }
147 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } 149 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; }
148 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; } 150 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; }
149 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; } 151 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; }
150 void setScript(UScriptCode s) { m_script = s; } 152 void setScript(UScriptCode s) { m_script = s; }
153 void setLocale(const String& locale) { m_locale = locale; }
151 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } 154 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; }
152 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } 155 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; }
153 void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featur eSettings = settings; } 156 void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featur eSettings = settings; }
154 void setTraits(FontTraits); 157 void setTraits(FontTraits);
155 void setWordSpacing(float s) { m_wordSpacing = s; } 158 void setWordSpacing(float s) { m_wordSpacing = s; }
156 void setLetterSpacing(float s) { m_letterSpacing = s; } 159 void setLetterSpacing(float s) { m_letterSpacing = s; }
157 160
158 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); } 161 TypesettingFeatures typesettingFeatures() const { return static_cast<Typeset tingFeatures>(m_typesettingFeatures); }
159 162
160 static void setSubpixelPositioning(bool b) { s_useSubpixelTextPositioning = b; } 163 static void setSubpixelPositioning(bool b) { s_useSubpixelTextPositioning = b; }
161 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; } 164 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; }
162 165
163 static void setDefaultTypesettingFeatures(TypesettingFeatures); 166 static void setDefaultTypesettingFeatures(TypesettingFeatures);
164 static TypesettingFeatures defaultTypesettingFeatures(); 167 static TypesettingFeatures defaultTypesettingFeatures();
165 168
166 private: 169 private:
167 FontFamily m_familyList; // The list of font families to be used. 170 FontFamily m_familyList; // The list of font families to be used.
168 RefPtr<FontFeatureSettings> m_featureSettings; 171 RefPtr<FontFeatureSettings> m_featureSettings;
172 String m_locale;
169 173
170 void updateTypesettingFeatures() const; 174 void updateTypesettingFeatures() const;
171 175
172 float m_specifiedSize; // Specified CSS value. Independent of rendering is sues such as integer 176 float m_specifiedSize; // Specified CSS value. Independent of rendering is sues such as integer
173 // rounding, minimum font sizes, and zooming. 177 // rounding, minimum font sizes, and zooming.
174 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor. 178 float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor.
175 179
176 float m_letterSpacing; 180 float m_letterSpacing;
177 float m_wordSpacing; 181 float m_wordSpacing;
178 182
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 && m_script == other.m_script 245 && m_script == other.m_script
242 && m_syntheticBold == other.m_syntheticBold 246 && m_syntheticBold == other.m_syntheticBold
243 && m_syntheticItalic == other.m_syntheticItalic 247 && m_syntheticItalic == other.m_syntheticItalic
244 && m_featureSettings == other.m_featureSettings 248 && m_featureSettings == other.m_featureSettings
245 && m_subpixelTextPosition == other.m_subpixelTextPosition; 249 && m_subpixelTextPosition == other.m_subpixelTextPosition;
246 } 250 }
247 251
248 } 252 }
249 253
250 #endif 254 #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