diff options
Diffstat (limited to 'WebCore/css/CSSFontFace.h')
-rw-r--r-- | WebCore/css/CSSFontFace.h | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/WebCore/css/CSSFontFace.h b/WebCore/css/CSSFontFace.h index ef281e3..41c9c55 100644 --- a/WebCore/css/CSSFontFace.h +++ b/WebCore/css/CSSFontFace.h @@ -26,8 +26,12 @@ #ifndef CSSFontFace_h #define CSSFontFace_h +#include "FontTraitsMask.h" +#include <wtf/HashSet.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/unicode/Unicode.h> namespace WebCore { @@ -38,26 +42,52 @@ class SimpleFontData; class CSSFontFace : public RefCounted<CSSFontFace> { public: - CSSFontFace() - : m_segmentedFontFace(0) - { - } + static PassRefPtr<CSSFontFace> create(FontTraitsMask traitsMask) { return adoptRef(new CSSFontFace(traitsMask)); } + ~CSSFontFace(); + + FontTraitsMask traitsMask() const { return m_traitsMask; } - virtual ~CSSFontFace(); + struct UnicodeRange; - void setSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace) { m_segmentedFontFace = segmentedFontFace; } + void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); } + const Vector<UnicodeRange>& ranges() const { return m_ranges; } + + void addedToSegmentedFontFace(CSSSegmentedFontFace*); + void removedFromSegmentedFontFace(CSSSegmentedFontFace*); bool isLoaded() const; - virtual bool isValid() const; + bool isValid() const; - virtual void addSource(CSSFontFaceSource*); + void addSource(CSSFontFaceSource*); void fontLoaded(CSSFontFaceSource*); - virtual SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic); + SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic); + + struct UnicodeRange { + UnicodeRange(UChar32 from, UChar32 to) + : m_from(from) + , m_to(to) + { + } + + UChar32 from() const { return m_from; } + UChar32 to() const { return m_to; } + + private: + UChar32 m_from; + UChar32 m_to; + }; private: - CSSSegmentedFontFace* m_segmentedFontFace; + CSSFontFace(FontTraitsMask traitsMask) + : m_traitsMask(traitsMask) + { + } + + FontTraitsMask m_traitsMask; + Vector<UnicodeRange> m_ranges; + HashSet<CSSSegmentedFontFace*> m_segmentedFontFaces; Vector<CSSFontFaceSource*> m_sources; }; |