本文整理汇总了C++中StyleResolver::fontSelector方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleResolver::fontSelector方法的具体用法?C++ StyleResolver::fontSelector怎么用?C++ StyleResolver::fontSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleResolver
的用法示例。
在下文中一共展示了StyleResolver::fontSelector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeNewScaledFontForStyle
void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, const RenderStyle* style, float& scalingFactor, Font& scaledFont)
{
ASSERT(style);
ASSERT(renderer);
Document* document = renderer->document();
ASSERT(document);
StyleResolver* styleResolver = document->styleResolver();
ASSERT(styleResolver);
// Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified
scalingFactor = SVGRenderingContext::calculateScreenFontSizeScalingFactor(renderer);
if (scalingFactor == 1 || !scalingFactor || style->fontDescription().textRenderingMode() == GeometricPrecision) {
scalingFactor = 1;
scaledFont = style->font();
return;
}
FontDescription fontDescription(style->fontDescription());
// FIXME: We need to better handle the case when we compute very small fonts below (below 1pt).
fontDescription.setComputedSize(StyleResolver::getComputedSizeFromSpecifiedSize(document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.computedSize(), DoNotUseSmartMinimumForFontSize));
scaledFont = Font(fontDescription, 0, 0);
scaledFont.update(styleResolver->fontSelector());
}
示例2: resolveTree
void resolveTree(Document& document, Change change)
{
bool resolveRootStyle = change == Force || (document.shouldDisplaySeamlesslyWithParent() && change >= Inherit);
if (resolveRootStyle) {
RefPtr<RenderStyle> documentStyle = resolveForDocument(document);
#if PLATFORM(IOS)
// Inserting the pictograph font at the end of the font fallback list is done by the
// font selector, so set a font selector if needed.
if (Settings* settings = document.settings()) {
StyleResolver* styleResolver = document.styleResolverIfExists();
if (settings->fontFallbackPrefersPictographs() && styleResolver)
documentStyle->font().update(styleResolver->fontSelector());
}
#endif
Style::Change documentChange = determineChange(documentStyle.get(), document.renderer()->style(), document.settings());
if (documentChange != NoChange)
document.renderer()->setStyle(documentStyle.release());
}
Element* documentElement = document.documentElement();
if (!documentElement)
return;
if (change < Inherit && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
return;
resolveTree(*documentElement, change);
}
示例3: setFontFromControlSize
void RenderThemeSafari::setFontFromControlSize(StyleResolver& styleResolver, RenderStyle& style, NSControlSize controlSize) const
{
FontDescription fontDescription;
fontDescription.setIsAbsoluteSize(true);
fontDescription.setGenericFamily(FontDescription::SerifFamily);
float fontSize = systemFontSizeForControlSize(controlSize);
fontDescription.setOneFamily("Lucida Grande");
fontDescription.setComputedSize(fontSize);
fontDescription.setSpecifiedSize(fontSize);
// Reset line height
style.setLineHeight(RenderStyle::initialLineHeight());
if (style.setFontDescription(fontDescription))
style.font().update(styleResolver.fontSelector());
}