这篇教程C++ FontPlatformData函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FontPlatformData函数的典型用法代码示例。如果您正苦于以下问题:C++ FontPlatformData函数的具体用法?C++ FontPlatformData怎么用?C++ FontPlatformData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FontPlatformData函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ASSERTFontPlatformData 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,
示例2: ASSERTFontPlatformData 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,
示例3: ENABLEFontPlatformData 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,
示例4: ENABLEFontPlatformData 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,
示例5: adoptCFFontPlatformData 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,
示例6: ENABLEFontPlatformData 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,
示例7: FontDataconst 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,
示例8: WebCore_GetJavaEnvFontPlatformData 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,
示例9: ENABLEFontPlatformData 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,
示例10: GetObjectPassRefPtr<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,
示例11: GetObjectPassOwnPtr<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,
示例12: FontPlatformDataFontPlatformData 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,
示例13: lroundfPassRefPtr<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,
示例14: lroundfSimpleFontData* 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,
示例15: adoptCFFontPlatformData 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,
示例16: OSFontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, TextOrientation textOrientation, FontWidthVariant, FontRenderingMode mode){#if OS(WINDOWS) 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(); } memcpy(logFont.lfFaceName, m_name.charactersWithNullTermination(), sizeof(logFont.lfFaceName[0]) * (1 + m_name.length())); // FIXME: almost identical to FillLogFont in FontCacheWin.cpp. // Need to refactor. logFont.lfHeight = -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 = PlatformSupport::layoutTestMode() ? 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);#elif OS(UNIX) || PLATFORM(BREWMP) ASSERT(m_fontReference); return FontPlatformData(m_fontReference, "", size, bold && !m_fontReference->isBold(), italic && !m_fontReference->isItalic(), orientation, textOrientation);#else notImplemented(); return FontPlatformData();#endif}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:44,
示例17: m_platformDataSimpleFontData::SimpleFontData(PassOwnPtr<SVGFontData> svgFontData, int size, bool syntheticBold, bool syntheticItalic) : m_platformData(FontPlatformData(size, syntheticBold, syntheticItalic)) , m_treatAsFixedPitch(false) , m_svgFontData(svgFontData) , m_isCustomFont(true) , m_isLoading(false) , m_isTextOrientationFallback(false) , m_isBrokenIdeographFallback(false) , m_hasVerticalGlyphs(false){ SVGFontFaceElement* svgFontFaceElement = m_svgFontData->svgFontFaceElement(); unsigned unitsPerEm = svgFontFaceElement->unitsPerEm(); float scale = size; if (unitsPerEm) scale /= unitsPerEm; float xHeight = svgFontFaceElement->xHeight() * scale; float ascent = svgFontFaceElement->ascent() * scale; float descent = svgFontFaceElement->descent() * scale; float lineGap = 0.1f * size; SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement(); if (!xHeight) { // Fallback if x_heightAttr is not specified for the font element. Vector<SVGGlyphIdentifier> letterXGlyphs; associatedFontElement->getGlyphIdentifiersForString(String("x", 1), letterXGlyphs); xHeight = letterXGlyphs.isEmpty() ? 2 * ascent / 3 : letterXGlyphs.first().horizontalAdvanceX * scale; } m_fontMetrics.setUnitsPerEm(unitsPerEm); m_fontMetrics.setAscent(ascent); m_fontMetrics.setDescent(descent); m_fontMetrics.setLineGap(lineGap); m_fontMetrics.setLineSpacing(roundf(ascent) + roundf(descent) + roundf(lineGap)); m_fontMetrics.setXHeight(xHeight); Vector<SVGGlyphIdentifier> spaceGlyphs; associatedFontElement->getGlyphIdentifiersForString(String(" ", 1), spaceGlyphs); m_spaceWidth = spaceGlyphs.isEmpty() ? xHeight : spaceGlyphs.first().horizontalAdvanceX * scale; Vector<SVGGlyphIdentifier> numeralZeroGlyphs; associatedFontElement->getGlyphIdentifiersForString(String("0", 1), numeralZeroGlyphs); m_avgCharWidth = numeralZeroGlyphs.isEmpty() ? m_spaceWidth : numeralZeroGlyphs.first().horizontalAdvanceX * scale; Vector<SVGGlyphIdentifier> letterWGlyphs; associatedFontElement->getGlyphIdentifiersForString(String("W", 1), letterWGlyphs); m_maxCharWidth = letterWGlyphs.isEmpty() ? ascent : letterWGlyphs.first().horizontalAdvanceX * scale; // FIXME: is there a way we can get the space glyph from the SVGGlyphIdentifier above? m_spaceGlyph = 0; m_zeroWidthSpaceGlyph = 0; determinePitch(); m_missingGlyphData.fontData = this; m_missingGlyphData.glyph = 0;}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:56,
示例18: ASSERTFontPlatformData FontCustomPlatformData::fontPlatformData( float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant) { ASSERT(m_typeface); return FontPlatformData(m_typeface, "", size, bold && !m_typeface->isBold(), italic && !m_typeface->isItalic(), orientation);}
开发者ID:HansMuller,项目名称:engine,代码行数:10,
示例19: m_platformDataSimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, float fontSize, bool syntheticBold, bool syntheticItalic) : m_platformData( FontPlatformData(fontSize, syntheticBold, syntheticItalic)), m_isTextOrientationFallback(false), m_verticalData(nullptr), m_hasVerticalGlyphs(false), m_customFontData(customData) {}
开发者ID:mirror,项目名称:chromium,代码行数:10,
示例20: FontPlatformDataFontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode){ QFont font; font.setFamily(QFontDatabase::applicationFontFamilies(m_handle)[0]); font.setPixelSize(size); if (bold) font.setWeight(QFont::Bold); font.setItalic(italic); return FontPlatformData(font);}
开发者ID:manduva,项目名称:phantomjs,代码行数:11,
示例21: m_platformDataSimpleFontData::SimpleFontData(PassOwnPtr<AdditionalFontData> fontData, float fontSize, bool syntheticBold, bool syntheticItalic) : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) , m_fontData(fontData) , m_treatAsFixedPitch(false) , m_isCustomFont(true) , m_isLoading(false) , m_isTextOrientationFallback(false) , m_isBrokenIdeographFallback(false) , m_hasVerticalGlyphs(false){ m_fontData->initializeFontData(this, fontSize);}
开发者ID:1833183060,项目名称:wke,代码行数:12,
示例22: lroundfPassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const FontDescription& fontDescription, float scaleFactor) const{ const float scaledSize = lroundf(fontDescription.computedSize() * scaleFactor); return adoptRef(new SimpleFontData( FontPlatformData(m_platformData.font()->cur_lfnt->name, scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.orientation(), m_platformData.widthVariant()), isCustomFont(), false));}
开发者ID:3163504123,项目名称:phantomjs,代码行数:12,
示例23: m_platformDataSimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, float fontSize, bool syntheticBold, bool syntheticItalic) : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) , m_treatAsFixedPitch(false) , m_isTextOrientationFallback(false) , m_isBrokenIdeographFallback(false)#if ENABLE(OPENTYPE_VERTICAL) , m_verticalData(nullptr)#endif , m_hasVerticalGlyphs(false) , m_customFontData(customData){ if (m_customFontData) m_customFontData->initializeFontData(this, fontSize);}
开发者ID:kublaj,项目名称:blink,代码行数:14,
示例24: scaledFontRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const{ float scaledSize = scaleFactor * m_platformData.size(); if (isCustomFont()) { FontPlatformData scaledFont(m_platformData); scaledFont.setSize(scaledSize); return Font::create(scaledFont, true, false); } LOGFONT winfont; GetObject(m_platformData.hfont(), sizeof(LOGFONT), &winfont); winfont.lfHeight = -lroundf(scaledSize * (m_platformData.useGDI() ? 1 : 32)); auto hfont = adoptGDIObject(::CreateFontIndirect(&winfont)); return Font::create(FontPlatformData(WTFMove(hfont), scaledSize, m_platformData.syntheticBold(), m_platformData.syntheticOblique(), m_platformData.useGDI()), isCustomFont(), false);}
开发者ID:quanmo,项目名称:webkit,代码行数:15,
示例25: m_platformDataSimpleFontData::SimpleFontData(std::unique_ptr<AdditionalFontData> fontData, float fontSize, bool syntheticBold, bool syntheticItalic) : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) , m_fontData(std::move(fontData)) , m_treatAsFixedPitch(false) , m_isCustomFont(true) , m_isLoading(false) , m_isTextOrientationFallback(false) , m_isBrokenIdeographFallback(false)#if ENABLE(OPENTYPE_VERTICAL) , m_verticalData(0)#endif , m_hasVerticalGlyphs(false){ m_fontData->initializeFontData(this, fontSize);}
开发者ID:liudengyong,项目名称:webkit,代码行数:15,
示例26: GetObjectSimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const{ if (!m_smallCapsFontData) { LOGFONT winFont; GetObject(m_font.hfont(), sizeof(LOGFONT), &winFont); float smallCapsSize = 0.70f * fontDescription.computedSize(); // Unlike WebKit trunk, we don't multiply the size by 32. That seems // to be some kind of artifact of their CG backend, or something. winFont.lfHeight = -lroundf(smallCapsSize); HFONT hfont = CreateFontIndirect(&winFont); m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsSize)); } return m_smallCapsFontData;}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:15,
注:本文中的FontPlatformData函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Foo函数代码示例 C++ Font函数代码示例 |