当前位置: 首页>>代码示例>>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;未经允许,请勿转载。