本文整理汇总了C++中FontDescription::fontSynthesis方法的典型用法代码示例。如果您正苦于以下问题:C++ FontDescription::fontSynthesis方法的具体用法?C++ FontDescription::fontSynthesis怎么用?C++ FontDescription::fontSynthesis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontDescription
的用法示例。
在下文中一共展示了FontDescription::fontSynthesis方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fontRanges
FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
{
if (!isValid())
return FontRanges();
FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
// FIXME: Unify this function with FontDescriptionKey in FontCache.h (Or just use the regular FontCache instead of this)
unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + FontWidthVariantWidth + FontSynthesisWidth + 1))
| (fontDescription.fontSynthesis() << (FontTraitsMaskWidth + FontWidthVariantWidth + 1))
| ((fontDescription.orientation() == Vertical ? 1 : 0) << (FontTraitsMaskWidth + FontWidthVariantWidth))
| fontDescription.widthVariant() << FontTraitsMaskWidth
| desiredTraitsMask;
auto addResult = m_descriptionToRangesMap.add(hashKey, FontRanges());
auto& fontRanges = addResult.iterator->value;
if (addResult.isNewEntry) {
for (auto& face : m_fontFaces) {
if (!face->isValid())
continue;
FontTraitsMask traitsMask = face->traitsMask();
bool syntheticBold = (fontDescription.fontSynthesis() & FontSynthesisWeight) && !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
bool syntheticItalic = (fontDescription.fontSynthesis() & FontSynthesisStyle) && !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
if (RefPtr<Font> faceFont = face->font(fontDescription, syntheticBold, syntheticItalic))
appendFontWithInvalidUnicodeRangeIfLoading(fontRanges, faceFont.releaseNonNull(), face->ranges());
}
}
return fontRanges;
}
示例2: fontRanges
FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
{
FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
auto addResult = m_cache.add(FontDescriptionKey(fontDescription), FontRanges());
auto& fontRanges = addResult.iterator->value;
if (addResult.isNewEntry) {
for (auto& face : m_fontFaces) {
if (face->allSourcesFailed())
continue;
FontTraitsMask traitsMask = face->traitsMask();
bool syntheticBold = (fontDescription.fontSynthesis() & FontSynthesisWeight) && !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
bool syntheticItalic = (fontDescription.fontSynthesis() & FontSynthesisStyle) && !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
if (RefPtr<Font> faceFont = face->font(fontDescription, syntheticBold, syntheticItalic))
appendFontWithInvalidUnicodeRangeIfLoading(fontRanges, faceFont.releaseNonNull(), face->ranges());
}
}
return fontRanges;
}