#define FontDescription_h
#include "platform/FontFamilyNames.h"
+#include "platform/fonts/FixedPitchFontType.h"
#include "platform/fonts/FontCacheKey.h"
#include "platform/fonts/FontFamily.h"
#include "platform/fonts/FontFeatureSettings.h"
#include <unicode/uscript.h>
-namespace WebCore {
+namespace blink {
class PLATFORM_EXPORT FontDescription {
public:
bool operator==(const FontDescription&) const;
bool operator!=(const FontDescription& other) const { return !(*this == other); }
+ struct VariantLigatures {
+ VariantLigatures()
+ : common(NormalLigaturesState)
+ , discretionary(NormalLigaturesState)
+ , historical(NormalLigaturesState)
+ , contextual(NormalLigaturesState)
+ {
+ }
+
+ unsigned common : 2;
+ unsigned discretionary : 2;
+ unsigned historical : 2;
+ unsigned contextual : 2;
+ };
+
const FontFamily& family() const { return m_familyList; }
FontFamily& firstFamily() { return m_familyList; }
float specifiedSize() const { return m_specifiedSize; }
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;
+ static FontWeight lighterWeight(FontWeight);
+ static FontWeight bolderWeight(FontWeight);
GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); }
// 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() == FontFamilyNames::webkit_monospace; }
+ FixedPitchFontType fixedPitchFontType() const
+ {
+ if (genericFamily() == MonospaceFamily && !family().next() && family().family() == FontFamilyNames::webkit_monospace)
+ return FixedPitchFont;
+ return NonFixedPitchFont;
+ }
Kerning kerning() const { return static_cast<Kerning>(m_kerning); }
+ VariantLigatures variantLigatures() const;
LigaturesState commonLigaturesState() const { return static_cast<LigaturesState>(m_commonLigaturesState); }
LigaturesState discretionaryLigaturesState() const { return static_cast<LigaturesState>(m_discretionaryLigaturesState); }
LigaturesState historicalLigaturesState() const { return static_cast<LigaturesState>(m_historicalLigaturesState); }
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;
float effectiveFontSize() const; // Returns either the computedSize or the computedPixelSize
- FontCacheKey cacheKey(const AtomicString& familyName, FontTraits desiredTraits = FontTraits(0)) const;
+ FontCacheKey cacheKey(const FontFaceCreationParams&, FontTraits desiredTraits = FontTraits(0)) const;
void setFamily(const FontFamily& family) { m_familyList = family; }
void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); }
void setStyle(FontStyle i) { m_style = i; }
void setVariant(FontVariant c) { m_variant = c; }
+ void setVariantLigatures(const VariantLigatures&);
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 setKerning(Kerning kerning) { m_kerning = kerning; updateTypesettingFeatures(); }
- void setCommonLigaturesState(LigaturesState commonLigaturesState) { m_commonLigaturesState = commonLigaturesState; updateTypesettingFeatures(); }
- void setDiscretionaryLigaturesState(LigaturesState discretionaryLigaturesState) { m_discretionaryLigaturesState = discretionaryLigaturesState; updateTypesettingFeatures(); }
- void setHistoricalLigaturesState(LigaturesState historicalLigaturesState) { m_historicalLigaturesState = historicalLigaturesState; updateTypesettingFeatures(); }
- void setContextualLigaturesState(LigaturesState contextualLigaturesState) { m_contextualLigaturesState = contextualLigaturesState; updateTypesettingFeatures(); }
void setKeywordSize(unsigned s) { m_keywordSize = s; }
void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
void setTextRendering(TextRenderingMode rendering) { m_textRendering = rendering; updateTypesettingFeatures(); }
&& m_subpixelTextPosition == other.m_subpixelTextPosition;
}
-}
+} // namespace blink
#endif