當前位置: 首頁>>代碼示例>>C++>>正文


C++ FontPlatformData函數代碼示例

本文整理匯總了C++中FontPlatformData函數的典型用法代碼示例。如果您正苦於以下問題:C++ FontPlatformData函數的具體用法?C++ FontPlatformData怎麽用?C++ FontPlatformData使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FontPlatformData函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ASSERT

FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
{
    ASSERT(m_typeface);
#if OS(WIN)
    // FIXME: Skia currently renders synthetic bold and italics with hinting and without
    // linear metrics on windows. Using CreateFromName and specifying the bold/italics
    // style allows for proper rendering of synthetic style. Once Skia has been updated
    // this workaround will no longer be needed. crbug.com/332958
    bool syntheticBold = bold && !m_typeface->isBold();
    bool syntheticItalic = italic && !m_typeface->isItalic();
    if (syntheticBold || syntheticItalic) {
        SkString name;
        m_typeface->getFamilyName(&name);

        int style = SkTypeface::kNormal;
        if (syntheticBold)
            style |= SkTypeface::kBold;
        if (syntheticItalic)
            style |= SkTypeface::kItalic;

        RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()->legacyCreateTypeface(name.c_str(), static_cast<SkTypeface::Style>(style)));
        syntheticBold = false;
        syntheticItalic = false;
        return FontPlatformData(typeface.release(), "", size, syntheticBold, syntheticItalic, orientation);
    }
#endif
    return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isBold(), italic && !m_typeface->isItalic(), orientation);
}
開發者ID:glenkim-dev,項目名稱:blink-crosswalk,代碼行數:28,代碼來源:FontCustomPlatformDataSkia.cpp

示例2: ASSERT

FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
{
    ASSERT(m_fontReference);

    LOGFONT logFont;
    // m_name comes from createUniqueFontName, which, in turn, gets
    // it from base64-encoded uuid (128-bit). So, m_name
    // can never be longer than LF_FACESIZE (32).
    if (m_name.length() + 1 >= LF_FACESIZE) {
        ASSERT_NOT_REACHED();
        return FontPlatformData();
    }
    unsigned len = m_name.copyTo(logFont.lfFaceName, 0, LF_FACESIZE - 1);
    logFont.lfFaceName[len] = '\0';

    // FIXME: almost identical to FillLogFont in FontCacheWin.cpp.
    // Need to refactor.
    logFont.lfHeight = -static_cast<int>(size);
    logFont.lfWidth = 0;
    logFont.lfEscapement = 0;
    logFont.lfOrientation = 0;
    logFont.lfUnderline = false;
    logFont.lfStrikeOut = false;
    logFont.lfCharSet = DEFAULT_CHARSET;
    logFont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
    logFont.lfQuality = isRunningLayoutTest() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings.
    logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
    logFont.lfItalic = italic;
    logFont.lfWeight = bold ? FW_BOLD : FW_DONTCARE;

    HFONT hfont = CreateFontIndirect(&logFont);
    return FontPlatformData(hfont, size, orientation);
}
開發者ID:chunywang,項目名稱:blink-crosswalk,代碼行數:33,代碼來源:FontCustomPlatformDataWin.cpp

示例3: ENABLE

FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontRenderingMode renderingMode)
{
#if ENABLE(SVG_FONTS)
    if (m_externalSVGDocument)
        return FontPlatformData(size, bold, italic);
#endif
#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(ISEE)
    ASSERT(m_fontData);
    return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, renderingMode);
#else
    return FontPlatformData();
#endif
}
開發者ID:Czerrr,項目名稱:ISeeBrowser,代碼行數:13,代碼來源:CachedFont.cpp

示例4: ENABLE

FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontRenderingMode renderingMode)
{
#if ENABLE(SVG_FONTS)
    if (m_externalSVGDocument)
        return FontPlatformData(size, bold, italic);
#endif
#ifdef STORE_FONT_CUSTOM_PLATFORM_DATA
    ASSERT(m_fontData);
    return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, renderingMode);
#else
    return FontPlatformData();
#endif
}
開發者ID:325116067,項目名稱:semc-qsd8x50,代碼行數:13,代碼來源:CachedFont.cpp

示例5: adoptCF

FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic)
{
    int size = fontDescription.computedPixelSize();
    FontOrientation orientation = fontDescription.orientation();
    FontWidthVariant widthVariant = fontDescription.widthVariant();
#if CORETEXT_WEB_FONTS
    RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
    font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), fontDescription.featureSettings());
    return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
#else
    return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
#endif
}
開發者ID:nickooms,項目名稱:webkit,代碼行數:13,代碼來源:FontCustomPlatformData.cpp

示例6: ENABLE

FontPlatformData CachedFont::platformDataFromCustomData(const FontDescription &fontDescription)
{
#if ENABLE(SVG_FONTS)
    if (m_externalSVGDocument)
        return FontPlatformData(size, bold, italic);
#endif
#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(BAL)
    ASSERT(m_fontData);
    return m_fontData->fontPlatformData(fontDescription);
#else
    return FontPlatformData();
#endif
}
開發者ID:JonasZ95,項目名稱:EAWebkit,代碼行數:13,代碼來源:CachedFont.cpp

示例7: FontData

const FontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{

    FontData* fontData = 0;
    fontData = new FontData(FontPlatformData(font.fontDescription(), font.family().family()));
    return fontData;
}
開發者ID:cdaffara,項目名稱:symbiandump-mw4,代碼行數:7,代碼來源:FontCacheGtk.cpp

示例8: WebCore_GetJavaEnv

FontPlatformData FontCustomPlatformData::fontPlatformData(
        int size,
        bool bold,
        bool italic,
        FontOrientation,
        FontWidthVariant,
        FontRenderingMode)
{
    JNIEnv* env = WebCore_GetJavaEnv();

    static jmethodID mid = env->GetMethodID(
            PG_GetFontCustomPlatformDataClass(env),
            "createFont",
            "(IZZ)Lcom/sun/webkit/graphics/WCFont;");
    ASSERT(mid);

    JLObject font(env->CallObjectMethod(
            m_data,
            mid,
            size,
            bool_to_jbool(bold),
            bool_to_jbool(italic)));
    CheckAndClearException(env);

    return FontPlatformData(RQRef::create(font), size);
}
開發者ID:166MMX,項目名稱:openjdk.java.net-openjfx-8u40-rt,代碼行數:26,代碼來源:FontCustomPlatformData.cpp

示例9: ENABLE

FontPlatformData FontResource::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
{
#if ENABLE(SVG_FONTS)
    if (m_externalSVGDocument)
        return FontPlatformData(size, bold, italic);
#endif
    ASSERT(m_fontData);
    return m_fontData->fontPlatformData(size, bold, italic, orientation, widthVariant);
}
開發者ID:chunywang,項目名稱:blink-crosswalk,代碼行數:9,代碼來源:FontResource.cpp

示例10: GetObject

PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
{
    LOGFONT winFont;
    GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winFont);
    float scaledSize = scaleFactor * fontDescription.computedSize();
    winFont.lfHeight = -lroundf(scaledSize);
    HFONT hfont = CreateFontIndirect(&winFont);
    return SimpleFontData::create(FontPlatformData(hfont, scaledSize, m_platformData.orientation()), isCustomFont() ? CustomFontData::create(false) : 0);
}
開發者ID:Igalia,項目名稱:blink,代碼行數:9,代碼來源:SimpleFontDataWin.cpp

示例11: GetObject

PassOwnPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const
{
    LOGFONT winFont;
    GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winFont);
    float scaledSize = scaleFactor * fontDescription.computedSize();
    winFont.lfHeight = -lroundf(scaledSize);
    HFONT hfont = CreateFontIndirect(&winFont);
    return adoptPtr(new SimpleFontData(FontPlatformData(hfont, scaledSize), isCustomFont(), false));
}
開發者ID:sysrqb,項目名稱:chromium-src,代碼行數:9,代碼來源:SimpleFontDataChromiumWin.cpp

示例12: FontPlatformData

FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode renderingMode)
{
    FontDescription fontDesc;
    fontDesc.setComputedSize(size);
    fontDesc.setSpecifiedSize(size);
    fontDesc.setItalic(italic);
    fontDesc.setWeight(bold ? FontWeightBold : FontWeightNormal);
    return FontPlatformData(fontDesc, m_name, false);
}
開發者ID:dog-god,項目名稱:iptv,代碼行數:9,代碼來源:FontCustomPlatformData.cpp

示例13: lroundf

PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(
    const FontDescription& fontDescription,
    float scaleFactor) const {
  const float scaledSize =
      lroundf(fontDescription.computedSize() * scaleFactor);
  return SimpleFontData::create(
      FontPlatformData(m_platformData, scaledSize),
      isCustomFont() ? CustomFontData::create() : nullptr);
}
開發者ID:mirror,項目名稱:chromium,代碼行數:9,代碼來源:SimpleFontData.cpp

示例14: lroundf

SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
{
    if (!m_smallCapsFontData) {
        const float smallCapsSize = lroundf(fontDescription.computedSize() * smallCapsFraction);
        m_smallCapsFontData = new SimpleFontData(FontPlatformData(m_font, smallCapsSize));
    }

    return m_smallCapsFontData;
}
開發者ID:marshall,項目名稱:webkit_titanium,代碼行數:9,代碼來源:SimpleFontDataLinux.cpp

示例15: adoptCF

FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings)
{
    int size = fontDescription.computedPixelSize();
    FontOrientation orientation = fontDescription.orientation();
    FontWidthVariant widthVariant = fontDescription.widthVariant();
    RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
    font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), &fontFaceFeatures, &fontFaceVariantSettings, fontDescription.featureSettings(), fontDescription.variantSettings());
    return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode());
}
開發者ID:josedealcala,項目名稱:webkit,代碼行數:9,代碼來源:FontCustomPlatformData.cpp


注:本文中的FontPlatformData函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。