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

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

Issue 447443003: Remove custom style building for font-variant-ligatures. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 , m_syntheticBold(false) 81 , m_syntheticBold(false)
82 , m_syntheticItalic(false) 82 , m_syntheticItalic(false)
83 , m_subpixelTextPosition(s_useSubpixelTextPositioning) 83 , m_subpixelTextPosition(s_useSubpixelTextPositioning)
84 , m_typesettingFeatures(s_defaultTypesettingFeatures) 84 , m_typesettingFeatures(s_defaultTypesettingFeatures)
85 { 85 {
86 } 86 }
87 87
88 bool operator==(const FontDescription&) const; 88 bool operator==(const FontDescription&) const;
89 bool operator!=(const FontDescription& other) const { return !(*this == othe r); } 89 bool operator!=(const FontDescription& other) const { return !(*this == othe r); }
90 90
91 struct VariantLigatures {
92 VariantLigatures()
93 : common(NormalLigaturesState)
94 , discretionary(NormalLigaturesState)
95 , historical(NormalLigaturesState)
96 , contextual(NormalLigaturesState)
97 {
98 }
99
100 unsigned common : 2;
101 unsigned discretionary : 2;
102 unsigned historical : 2;
103 unsigned contextual : 2;
104 };
105
91 const FontFamily& family() const { return m_familyList; } 106 const FontFamily& family() const { return m_familyList; }
92 FontFamily& firstFamily() { return m_familyList; } 107 FontFamily& firstFamily() { return m_familyList; }
93 float specifiedSize() const { return m_specifiedSize; } 108 float specifiedSize() const { return m_specifiedSize; }
94 float computedSize() const { return m_computedSize; } 109 float computedSize() const { return m_computedSize; }
95 FontStyle style() const { return static_cast<FontStyle>(m_style); } 110 FontStyle style() const { return static_cast<FontStyle>(m_style); }
96 int computedPixelSize() const { return int(m_computedSize + 0.5f); } 111 int computedPixelSize() const { return int(m_computedSize + 0.5f); }
97 FontVariant variant() const { return static_cast<FontVariant>(m_variant); } 112 FontVariant variant() const { return static_cast<FontVariant>(m_variant); }
98 bool isAbsoluteSize() const { return m_isAbsoluteSize; } 113 bool isAbsoluteSize() const { return m_isAbsoluteSize; }
99 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } 114 FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
100 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); } 115 FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); }
101 FontWeight lighterWeight() const; 116 FontWeight lighterWeight() const;
102 FontWeight bolderWeight() const; 117 FontWeight bolderWeight() const;
103 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy pe>(m_genericFamily); } 118 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyTy pe>(m_genericFamily); }
104 119
105 // only use fixed default size when there is only one font family, and that family is "monospace" 120 // only use fixed default size when there is only one font family, and that family is "monospace"
106 FixedPitchFontType fixedPitchFontType() const 121 FixedPitchFontType fixedPitchFontType() const
107 { 122 {
108 if (genericFamily() == MonospaceFamily && !family().next() && family().f amily() == FontFamilyNames::webkit_monospace) 123 if (genericFamily() == MonospaceFamily && !family().next() && family().f amily() == FontFamilyNames::webkit_monospace)
109 return FixedPitchFont; 124 return FixedPitchFont;
110 return NonFixedPitchFont; 125 return NonFixedPitchFont;
111 } 126 }
112 Kerning kerning() const { return static_cast<Kerning>(m_kerning); } 127 Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
128 VariantLigatures variantLigatures() const;
113 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); } 129 LigaturesState commonLigaturesState() const { return static_cast<LigaturesSt ate>(m_commonLigaturesState); }
114 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); } 130 LigaturesState discretionaryLigaturesState() const { return static_cast<Liga turesState>(m_discretionaryLigaturesState); }
115 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); } 131 LigaturesState historicalLigaturesState() const { return static_cast<Ligatur esState>(m_historicalLigaturesState); }
116 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); } 132 LigaturesState contextualLigaturesState() const { return static_cast<Ligatur esState>(m_contextualLigaturesState); }
117 unsigned keywordSize() const { return m_keywordSize; } 133 unsigned keywordSize() const { return m_keywordSize; }
118 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); } 134 FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMo de>(m_fontSmoothing); }
119 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); } 135 TextRenderingMode textRendering() const { return static_cast<TextRenderingMo de>(m_textRendering); }
120 UScriptCode script() const { return static_cast<UScriptCode>(m_script); } 136 UScriptCode script() const { return static_cast<UScriptCode>(m_script); }
121 const String& locale() const { return m_locale; } 137 const String& locale() const { return m_locale; }
122 bool isSyntheticBold() const { return m_syntheticBold; } 138 bool isSyntheticBold() const { return m_syntheticBold; }
(...skipping 10 matching lines...) Expand all
133 FontDescription makeNormalFeatureSettings() const; 149 FontDescription makeNormalFeatureSettings() const;
134 150
135 float effectiveFontSize() const; // Returns either the computedSize or the c omputedPixelSize 151 float effectiveFontSize() const; // Returns either the computedSize or the c omputedPixelSize
136 FontCacheKey cacheKey(const FontFaceCreationParams&, FontTraits desiredTrait s = FontTraits(0)) const; 152 FontCacheKey cacheKey(const FontFaceCreationParams&, FontTraits desiredTrait s = FontTraits(0)) const;
137 153
138 void setFamily(const FontFamily& family) { m_familyList = family; } 154 void setFamily(const FontFamily& family) { m_familyList = family; }
139 void setComputedSize(float s) { m_computedSize = clampToFloat(s); } 155 void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
140 void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); } 156 void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); }
141 void setStyle(FontStyle i) { m_style = i; } 157 void setStyle(FontStyle i) { m_style = i; }
142 void setVariant(FontVariant c) { m_variant = c; } 158 void setVariant(FontVariant c) { m_variant = c; }
159 void setVariantLigatures(const VariantLigatures&);
143 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } 160 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
144 void setWeight(FontWeight w) { m_weight = w; } 161 void setWeight(FontWeight w) { m_weight = w; }
145 void setStretch(FontStretch s) { m_stretch = s; } 162 void setStretch(FontStretch s) { m_stretch = s; }
146 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g enericFamily; } 163 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = g enericFamily; }
147 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea tures(); } 164 void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFea tures(); }
148 void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_common LigaturesState = commonLigaturesState; updateTypesettingFeatures(); }
149 void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesSta te) { m_discretionaryLigaturesState = discretionaryLigaturesState; updateTypeset tingFeatures(); }
150 void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; updateTypesettingFeatures (); }
151 void setContextualLigaturesState(LigaturesState contextualLigaturesState) { m_contextualLigaturesState = contextualLigaturesState; updateTypesettingFeatures (); }
152 void setKeywordSize(unsigned s) { m_keywordSize = s; } 165 void setKeywordSize(unsigned s) { m_keywordSize = s; }
153 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; } 166 void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoot hing; }
154 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); } 167 void setTextRendering(TextRenderingMode rendering) { m_textRendering = rende ring; updateTypesettingFeatures(); }
155 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } 168 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; }
156 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; } 169 void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJ KGlyphOrientation = orientation; }
157 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; } 170 void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = width Variant; }
158 void setScript(UScriptCode s) { m_script = s; } 171 void setScript(UScriptCode s) { m_script = s; }
159 void setLocale(const String& locale) { m_locale = locale; } 172 void setLocale(const String& locale) { m_locale = locale; }
160 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } 173 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; }
161 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } 174 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 && m_script == other.m_script 264 && m_script == other.m_script
252 && m_syntheticBold == other.m_syntheticBold 265 && m_syntheticBold == other.m_syntheticBold
253 && m_syntheticItalic == other.m_syntheticItalic 266 && m_syntheticItalic == other.m_syntheticItalic
254 && m_featureSettings == other.m_featureSettings 267 && m_featureSettings == other.m_featureSettings
255 && m_subpixelTextPosition == other.m_subpixelTextPosition; 268 && m_subpixelTextPosition == other.m_subpixelTextPosition;
256 } 269 }
257 270
258 } 271 }
259 272
260 #endif 273 #endif
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderCustom.cpp ('k') | Source/platform/fonts/FontDescription.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698