本文整理汇总了C++中FontPlatformData::setSyntheticItalic方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPlatformData::setSyntheticItalic方法的具体用法?C++ FontPlatformData::setSyntheticItalic怎么用?C++ FontPlatformData::setSyntheticItalic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPlatformData
的用法示例。
在下文中一共展示了FontPlatformData::setSyntheticItalic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: description
PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescription& fontDescription, UChar32 c, const SimpleFontData*)
{
// First try the specified font with standard style & weight.
if (fontDescription.style() == FontStyleItalic
|| fontDescription.weight() >= FontWeight600) {
RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle(
fontDescription, c);
if (fontData)
return fontData;
}
FontCache::PlatformFallbackFont fallbackFont;
FontCache::getFontForCharacter(c, fontDescription.locale().ascii().data(), &fallbackFont);
if (fallbackFont.name.isEmpty())
return nullptr;
FontFaceCreationParams creationParams;
creationParams = FontFaceCreationParams(fallbackFont.filename, fallbackFont.fontconfigInterfaceId, fallbackFont.ttcIndex);
// Changes weight and/or italic of given FontDescription depends on
// the result of fontconfig so that keeping the correct font mapping
// of the given character. See http://crbug.com/32109 for details.
bool shouldSetSyntheticBold = false;
bool shouldSetSyntheticItalic = false;
FontDescription description(fontDescription);
if (fallbackFont.isBold && description.weight() < FontWeightBold)
description.setWeight(FontWeightBold);
if (!fallbackFont.isBold && description.weight() >= FontWeightBold) {
shouldSetSyntheticBold = true;
description.setWeight(FontWeightNormal);
}
if (fallbackFont.isItalic && description.style() == FontStyleNormal)
description.setStyle(FontStyleItalic);
if (!fallbackFont.isItalic && description.style() == FontStyleItalic) {
shouldSetSyntheticItalic = true;
description.setStyle(FontStyleNormal);
}
FontPlatformData* substitutePlatformData = getFontPlatformData(description, creationParams);
if (!substitutePlatformData)
return nullptr;
FontPlatformData platformData = FontPlatformData(*substitutePlatformData);
platformData.setSyntheticBold(shouldSetSyntheticBold);
platformData.setSyntheticItalic(shouldSetSyntheticItalic);
return fontDataFromFontPlatformData(&platformData, DoNotRetain);
}
示例2: substituteDescription
PassRefPtr<SimpleFontData> FontCache::fallbackOnStandardFontStyle(
const FontDescription& fontDescription,
UChar32 character) {
FontDescription substituteDescription(fontDescription);
substituteDescription.setStyle(FontStyleNormal);
substituteDescription.setWeight(FontWeightNormal);
FontFaceCreationParams creationParams(
substituteDescription.family().family());
FontPlatformData* substitutePlatformData =
getFontPlatformData(substituteDescription, creationParams);
if (substitutePlatformData &&
substitutePlatformData->fontContainsCharacter(character)) {
FontPlatformData platformData = FontPlatformData(*substitutePlatformData);
platformData.setSyntheticBold(fontDescription.weight() >= FontWeight600);
platformData.setSyntheticItalic(
fontDescription.style() == FontStyleItalic ||
fontDescription.style() == FontStyleOblique);
return fontDataFromFontPlatformData(&platformData, DoNotRetain);
}
return nullptr;
}