summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/graphics/FontDescription.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/FontDescription.h')
-rw-r--r--Source/WebCore/platform/graphics/FontDescription.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/Source/WebCore/platform/graphics/FontDescription.h b/Source/WebCore/platform/graphics/FontDescription.h
index 44368759d..b1abaee77 100644
--- a/Source/WebCore/platform/graphics/FontDescription.h
+++ b/Source/WebCore/platform/graphics/FontDescription.h
@@ -2,7 +2,7 @@
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* (C) 2000 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
*
* This library is free software; you can redistribute it and/or
@@ -25,14 +25,13 @@
#ifndef FontDescription_h
#define FontDescription_h
-#include "FontFamily.h"
#include "FontFeatureSettings.h"
#include "FontOrientation.h"
#include "FontRenderingMode.h"
#include "FontSmoothingMode.h"
#include "FontTraitsMask.h"
#include "FontWidthVariant.h"
-#include "TextOrientation.h"
+#include "NonCJKGlyphOrientation.h"
#include "TextRenderingMode.h"
#include "WebKitFontFamilyNames.h"
#include <wtf/MathExtras.h>
@@ -77,10 +76,11 @@ public:
enum LigaturesState { NormalLigaturesState, DisabledLigaturesState, EnabledLigaturesState };
FontDescription()
- : m_specifiedSize(0)
+ : m_families(1)
+ , m_specifiedSize(0)
, m_computedSize(0)
, m_orientation(Horizontal)
- , m_textOrientation(TextOrientationVerticalRight)
+ , m_nonCJKGlyphOrientation(NonCJKGlyphOrientationVerticalRight)
, m_widthVariant(RegularWidth)
, m_italic(FontItalicOff)
, m_smallCaps(FontSmallCapsOff)
@@ -103,9 +103,12 @@ public:
bool operator==(const FontDescription&) const;
bool operator!=(const FontDescription& other) const { return !(*this == other); }
-
- const FontFamily& family() const { return m_familyList; }
- FontFamily& firstFamily() { return m_familyList; }
+
+ unsigned familyCount() const { return m_families.size(); }
+ const AtomicString& firstFamily() const { return familyAt(0); }
+ const AtomicString& familyAt(unsigned i) const { return m_families[i]; }
+ const Vector<AtomicString, 1>& families() const { return m_families; }
+
float specifiedSize() const { return m_specifiedSize; }
float computedSize() const { return m_computedSize; }
FontItalic italic() const { return static_cast<FontItalic>(m_italic); }
@@ -118,7 +121,7 @@ public:
GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); }
bool usePrinterFont() const { return m_usePrinterFont; }
// only use fixed default size when there is only one font family, and that family is "monospace"
- bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == monospaceFamily; }
+ bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && familyCount() == 1 && firstFamily() == monospaceFamily; }
FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
LigaturesState commonLigaturesState() const { return static_cast<LigaturesState>(m_commonLigaturesState); }
@@ -132,12 +135,14 @@ public:
FontTraitsMask traitsMask() const;
bool isSpecifiedFont() const { return m_isSpecifiedFont; }
FontOrientation orientation() const { return static_cast<FontOrientation>(m_orientation); }
- TextOrientation textOrientation() const { return static_cast<TextOrientation>(m_textOrientation); }
+ NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<NonCJKGlyphOrientation>(m_nonCJKGlyphOrientation); }
FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant>(m_widthVariant); }
FontFeatureSettings* featureSettings() const { return m_featureSettings.get(); }
FontDescription makeNormalFeatureSettings() const;
- void setFamily(const FontFamily& family) { m_familyList = family; }
+ void setOneFamily(const AtomicString& family) { ASSERT(m_families.size() == 1); m_families[0] = family; }
+ void setFamilies(const Vector<AtomicString, 1>& families) { m_families = families; }
+ void adoptFamilies(Vector<AtomicString, 1>& families) { m_families.swap(families); }
void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); }
void setItalic(FontItalic i) { m_italic = i; }
@@ -147,11 +152,7 @@ public:
void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; }
void setWeight(FontWeight w) { m_weight = w; }
void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = genericFamily; }
-#if PLATFORM(CHROMIUM) && OS(DARWIN)
- void setUsePrinterFont(bool) { }
-#else
void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
-#endif
void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
void setKerning(Kerning kerning) { m_kerning = kerning; }
void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; }
@@ -162,13 +163,13 @@ public:
void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; }
void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
- void setTextOrientation(TextOrientation textOrientation) { m_textOrientation = textOrientation; }
+ void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = orientation; }
void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; }
void setScript(UScriptCode s) { m_script = s; }
void setFeatureSettings(PassRefPtr<FontFeatureSettings> settings) { m_featureSettings = settings; }
private:
- FontFamily m_familyList; // The list of font families to be used.
+ Vector<AtomicString, 1> m_families;
RefPtr<FontFeatureSettings> m_featureSettings;
float m_specifiedSize; // Specified CSS value. Independent of rendering issues such as integer
@@ -176,7 +177,7 @@ private:
float m_computedSize; // Computed size adjusted for the minimum font size and the zoom factor.
unsigned m_orientation : 1; // FontOrientation - Whether the font is rendering on a horizontal line or a vertical line.
- unsigned m_textOrientation : 1; // TextOrientation - Only used by vertical text. Determines the default orientation for non-ideograph glyphs.
+ unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used by vertical text. Determines the default orientation for non-ideograph glyphs.
unsigned m_widthVariant : 2; // FontWidthVariant
@@ -207,7 +208,7 @@ private:
inline bool FontDescription::operator==(const FontDescription& other) const
{
- return m_familyList == other.m_familyList
+ return m_families == other.m_families
&& m_specifiedSize == other.m_specifiedSize
&& m_computedSize == other.m_computedSize
&& m_italic == other.m_italic
@@ -226,7 +227,7 @@ inline bool FontDescription::operator==(const FontDescription& other) const
&& m_textRendering == other.m_textRendering
&& m_isSpecifiedFont == other.m_isSpecifiedFont
&& m_orientation == other.m_orientation
- && m_textOrientation == other.m_textOrientation
+ && m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation
&& m_widthVariant == other.m_widthVariant
&& m_script == other.m_script
&& m_featureSettings == other.m_featureSettings;