FontPlatformData.h [plain text]
#ifndef FontPlatformData_h
#define FontPlatformData_h
#include "GlyphBuffer.h"
#include "FontDescription.h"
#include <cairo.h>
#include <cairo-ft.h>
#include <fontconfig/fcfreetype.h>
namespace WebCore {
class FontPlatformData {
public:
class Deleted {};
FontPlatformData(Deleted)
: m_pattern(reinterpret_cast<FcPattern*>(-1))
, m_scaledFont(0)
{ }
FontPlatformData()
: m_pattern(0)
, m_scaledFont(0)
{ }
FontPlatformData(const FontDescription&, const AtomicString& family);
FontPlatformData(float size, bool bold, bool italic);
FontPlatformData(cairo_font_face_t* fontFace, int size, bool bold, bool italic);
~FontPlatformData();
static bool init();
bool isFixedPitch();
float size() const { return m_fontDescription.specifiedSize(); }
void setFont(cairo_t*) const;
unsigned hash() const
{
uintptr_t hashCodes[1] = { reinterpret_cast<uintptr_t>(m_scaledFont) };
return StringImpl::computeHash( reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
}
bool operator==(const FontPlatformData&) const;
FcPattern* m_pattern;
FontDescription m_fontDescription;
cairo_scaled_font_t* m_scaledFont;
};
}
#endif