当前位置: 首页>>代码示例>>C++>>正文


C++ FontPlatformData::setSyntheticItalic方法代码示例

本文整理汇总了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);
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:46,代码来源:FontCacheSkia.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:23,代码来源:


注:本文中的FontPlatformData::setSyntheticItalic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。