FontCustomPlatformData.h [plain text]
#ifndef FontCustomPlatformData_h
#define FontCustomPlatformData_h
#include "TextFlags.h"
#include <CoreFoundation/CFBase.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/RetainPtr.h>
typedef struct CGFont* CGFontRef;
typedef const struct __CTFontDescriptor* CTFontDescriptorRef;
namespace WebCore {
class FontPlatformData;
class SharedBuffer;
struct FontCustomPlatformData {
WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
public:
#if CORETEXT_WEB_FONTS
explicit FontCustomPlatformData(CTFontDescriptorRef fontDescriptor)
: m_fontDescriptor(fontDescriptor)
#else
explicit FontCustomPlatformData(CGFontRef cgFont)
: m_cgFont(cgFont)
#endif
{
}
~FontCustomPlatformData();
FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
static bool supportsFormat(const String&);
#if CORETEXT_WEB_FONTS
RetainPtr<CTFontDescriptorRef> m_fontDescriptor;
#else
RetainPtr<CGFontRef> m_cgFont;
#endif
};
std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&);
}
#endif