本文整理汇总了C++中FontDescription::isMonospace方法的典型用法代码示例。如果您正苦于以下问题:C++ FontDescription::isMonospace方法的具体用法?C++ FontDescription::isMonospace怎么用?C++ FontDescription::isMonospace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontDescription
的用法示例。
在下文中一共展示了FontDescription::isMonospace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkForGenericFamilyChange
void FontBuilder::checkForGenericFamilyChange(const FontDescription& oldDescription, FontDescription& newDescription)
{
if (newDescription.isAbsoluteSize())
return;
if (newDescription.isMonospace() == oldDescription.isMonospace())
return;
// For now, lump all families but monospace together.
if (newDescription.genericFamily() != FontDescription::MonospaceFamily
&& oldDescription.genericFamily() != FontDescription::MonospaceFamily)
return;
// We know the parent is monospace or the child is monospace, and that font
// size was unspecified. We want to scale our font size as appropriate.
// If the font uses a keyword size, then we refetch from the table rather than
// multiplying by our scale factor.
float size;
if (newDescription.keywordSize()) {
size = FontSize::fontSizeForKeyword(&m_document, newDescription.keywordSize(), newDescription.isMonospace());
} else {
Settings* settings = m_document.settings();
float fixedScaleFactor = (settings && settings->defaultFixedFontSize() && settings->defaultFontSize())
? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
: 1;
size = oldDescription.isMonospace() ?
newDescription.specifiedSize() / fixedScaleFactor :
newDescription.specifiedSize() * fixedScaleFactor;
}
newDescription.setSpecifiedSize(size);
}
示例2: updateSpecifiedSize
void FontBuilder::updateSpecifiedSize(FontDescription& fontDescription, const ComputedStyle& style)
{
float specifiedSize = fontDescription.specifiedSize();
if (!specifiedSize && fontDescription.keywordSize())
specifiedSize = fontSizeForKeyword(fontDescription.keywordSize(), fontDescription.isMonospace());
fontDescription.setSpecifiedSize(specifiedSize);
checkForGenericFamilyChange(style.getFontDescription(), fontDescription);
}