示例#1
0
std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
{
    FontPlatformData* ret = new FontPlatformData(fontDescription, family);

    if (!ret || !ret->font() || !ret->font()->font()) {
        delete ret;
        return nullptr;
    }

    return std::unique_ptr<FontPlatformData>(ret);
}
示例#2
0
PassRefPtr<Font>
Font::platformCreateScaledFont(const FontDescription& orig, float scaleFactor) const
{
    FontDescription d(orig);
    d.setComputedSize(orig.computedSize() * scaleFactor);
    d.setSpecifiedSize(orig.specifiedSize() * scaleFactor);
    FontPlatformData* ret = new FontPlatformData(d, m_platformData.font()->familyName().data());

    if (!ret || !ret->font() || !ret->font()->font()) {
        delete ret;
        return adoptRef((Font *)0);
    }

    return Font::create(*ret);
}