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

Unified Diff: Source/platform/fonts/FontDescription.h

Issue 183813005: Add font-stretch to FontDescription (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/fonts/FontDescription.h
diff --git a/Source/platform/fonts/FontDescription.h b/Source/platform/fonts/FontDescription.h
index e98c66374c16946be3f01e6fbc96cfb9ca9ee8ab..d4548a1d41a1204632704fec7950e78ae742d9ab 100644
--- a/Source/platform/fonts/FontDescription.h
+++ b/Source/platform/fonts/FontDescription.h
@@ -56,6 +56,20 @@ enum FontWeight {
FontWeightBold = FontWeight700
};
+// Numeric values matching OS/2 & Windows Metrics usWidthClass table.
+// https://www.microsoft.com/typography/otspec/os2.htm
+enum FontStretch {
+ FontStretchUltraCondensed = 1,
+ FontStretchExtraCondensed = 2,
+ FontStretchCondensed = 3,
+ FontStretchSemiCondensed = 4,
+ FontStretchNormal = 5,
+ FontStretchSemiExpanded = 6,
+ FontStretchExpanded = 7,
+ FontStretchExtraExpanded = 8,
+ FontStretchUltraExpanded = 9
+};
+
enum FontItalic {
FontItalicOff = 0,
FontItalicOn = 1
@@ -87,6 +101,7 @@ public:
, m_smallCaps(FontSmallCapsOff)
, m_isAbsoluteSize(false)
, m_weight(FontWeightNormal)
+ , m_stretch(FontStretchNormal)
, m_genericFamily(NoFamily)
, m_usePrinterFont(false)
, m_kerning(AutoKerning)
@@ -117,6 +132,7 @@ public:
FontSmallCaps smallCaps() const { return static_cast<FontSmallCaps>(m_smallCaps); }
bool isAbsoluteSize() const { return m_isAbsoluteSize; }
FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
+ FontStretch stretch() const { return static_cast<FontStretch>(m_stretch); }
FontWeight lighterWeight() const;
FontWeight bolderWeight() const;
GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); }
@@ -161,6 +177,7 @@ public:
void setSmallCaps(bool c) { setSmallCaps(c ? FontSmallCapsOn : FontSmallCapsOff); }
void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
void setWeight(FontWeight w) { m_weight = w; }
+ void setStretch(FontStretch s) { m_stretch = s; }
void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = genericFamily; }
void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
void setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFeatures(); }
@@ -213,6 +230,7 @@ private:
unsigned m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit size
// (logical sizes like "medium" don't count).
unsigned m_weight : 8; // FontWeight
+ unsigned m_stretch : 4; // FontStretch
unsigned m_genericFamily : 3; // GenericFamilyType
unsigned m_usePrinterFont : 1;
@@ -252,6 +270,7 @@ inline bool FontDescription::operator==(const FontDescription& other) const
&& m_smallCaps == other.m_smallCaps
&& m_isAbsoluteSize == other.m_isAbsoluteSize
&& m_weight == other.m_weight
+ && m_stretch == other.m_stretch
&& m_genericFamily == other.m_genericFamily
&& m_usePrinterFont == other.m_usePrinterFont
&& m_kerning == other.m_kerning

Powered by Google App Engine
This is Rietveld 408576698