Beispiel #1
0
FontCache::FontCache()
    : m_purgePreventCount(0)
{
    SkFontMgr* fontManager;

    if (s_useDirectWrite) {
        fontManager = SkFontMgr_New_DirectWrite(s_directWriteFactory);
        s_useSubpixelPositioning = RuntimeEnabledFeatures::subpixelFontScalingEnabled();
    } else {
        fontManager = SkFontMgr_New_GDI();
        // Subpixel text positioning is not supported by the GDI backend.
        s_useSubpixelPositioning = false;
    }

    ASSERT(fontManager);
    m_fontManager = adoptPtr(fontManager);
}
Beispiel #2
0
FontCache::FontCache()
    : m_purgePreventCount(0)
{
    SkFontMgr* fontManager = 0;

    // Prefer DirectWrite (if runtime feature is enabled) but fallback
    // to GDI on platforms where DirectWrite is not supported.
    if (RuntimeEnabledFeatures::directWriteEnabled())
        fontManager = SkFontMgr_New_DirectWrite();

    // Subpixel text positioning is not supported by the GDI backend.
    m_useSubpixelPositioning = fontManager
        ? RuntimeEnabledFeatures::subpixelFontScalingEnabled()
        : false;

    if (!fontManager)
        fontManager = SkFontMgr_New_GDI();

    m_fontManager = adoptPtr(fontManager);
}