本文整理汇总了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);
}
示例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);
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
示例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());
}