本文整理汇总了C++中FontPlatformData::setFakeItalic方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPlatformData::setFakeItalic方法的具体用法?C++ FontPlatformData::setFakeItalic怎么用?C++ FontPlatformData::setFakeItalic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPlatformData
的用法示例。
在下文中一共展示了FontPlatformData::setFakeItalic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atomicFamily
PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
icu::Locale locale = icu::Locale::getDefault();
FontCache::SimpleFontFamily family;
FontCache::getFontFamilyForCharacters(characters, length, locale.getLanguage(), font.fontDescription(), &family);
if (family.name.isEmpty())
return 0;
AtomicString atomicFamily(family.name);
// Changes weight and/or italic of given FontDescription depends on
// the result of fontconfig so that keeping the correct font mapping
// of the given characters. See http://crbug.com/32109 for details.
bool shouldSetFakeBold = false;
bool shouldSetFakeItalic = false;
FontDescription description(font.fontDescription());
if (family.isBold && description.weight() < FontWeightBold)
description.setWeight(FontWeightBold);
if (!family.isBold && description.weight() >= FontWeightBold) {
shouldSetFakeBold = true;
description.setWeight(FontWeightNormal);
}
if (family.isItalic && description.italic() == FontItalicOff)
description.setItalic(FontItalicOn);
if (!family.isItalic && description.italic() == FontItalicOn) {
shouldSetFakeItalic = true;
description.setItalic(FontItalicOff);
}
FontPlatformData* substitutePlatformData = getCachedFontPlatformData(description, atomicFamily, DoNotRetain);
if (!substitutePlatformData)
return 0;
FontPlatformData platformData = FontPlatformData(*substitutePlatformData);
platformData.setFakeBold(shouldSetFakeBold);
platformData.setFakeItalic(shouldSetFakeItalic);
return getCachedFontData(&platformData, DoNotRetain);
}