本文整理汇总了C++中FontDescription::IsBold方法的典型用法代码示例。如果您正苦于以下问题:C++ FontDescription::IsBold方法的具体用法?C++ FontDescription::IsBold怎么用?C++ FontDescription::IsBold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontDescription
的用法示例。
在下文中一共展示了FontDescription::IsBold方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFile
bool
Font::Load(const FontDescription &d)
{
assert(IsScreenInitialized());
bool bold = d.IsBold();
bool italic = d.IsItalic();
const char *path = nullptr;
/* check for presence of "real" font and clear the bold or italic
* flags if found so that freetype does not apply them again to
* produce a "synthetic" bold or italic version of the font */
if (italic && bold && bold_italic_font_path != nullptr) {
path = bold_italic_font_path;
bold = false;
italic = false;
} else if (italic && italic_font_path != nullptr) {
path = italic_font_path;
italic = false;
} else if (d.IsMonospace() && monospace_font_path != nullptr) {
path = monospace_font_path;
} else if (bold && bold_font_path != nullptr) {
path = bold_font_path;
bold = false;
} else {
path = font_path;
}
if (path == nullptr)
return false;
return LoadFile(path, d.GetHeight(), bold, italic);
}
示例2: m
//------------------------------------------------------------------------------
bool
Font::Load(const FontDescription& d)
{
if (d.IsBold() == true)
this->font.setWeight(QFont::Bold);
else
this->font.setWeight(QFont::Normal);
if (d.IsItalic() == true)
this->font.setStyle(QFont::StyleItalic);
else
this->font.setStyle(QFont::StyleNormal);
if (d.IsMonospace() == true)
this->font.setFamily("Courier");
else
this->font.setFamily("Sans");
this->font.setPointSize(d.GetHeight());
QFontMetrics m(this->font);
this->height = m.height();
this->ascent_height = m.ascent();
this->capital_height = this->height;
this->initialized = true;
return true;
}