本文整理汇总了C++中FontDescription::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ FontDescription::GetHeight方法的具体用法?C++ FontDescription::GetHeight怎么用?C++ FontDescription::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontDescription
的用法示例。
在下文中一共展示了FontDescription::GetHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: text_font_d
void
DialogLook::Initialise()
{
const FontDescription text_font_d(std::min(Layout::FontScale(12),
Layout::min_screen_pixels / 20));
const FontDescription small_font_d =
text_font_d.WithHeight(text_font_d.GetHeight() * 3u / 4u);
text_font.Load(text_font_d);
small_font.Load(small_font_d);
bold_font.Load(text_font_d.WithBold());
caption.text_color = COLOR_BLACK;
caption.font = &text_font;
#ifdef EYE_CANDY
caption.background_bitmap.Load(IDB_DIALOGTITLE);
#endif
caption.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR_DARK;
caption.inactive_background_color = COLOR_GRAY;
if (IsDithered())
SetBackgroundColor(COLOR_WHITE);
else
SetBackgroundColor(Color(0xe2, 0xdc, 0xbe));
text_color = COLOR_BLACK;
button.Initialise(bold_font);
check_box.Initialise(text_font);
focused.background_color = COLOR_XCSOAR_DARK;
focused.text_color = COLOR_WHITE;
focused.border_pen.Create(Layout::FastScale(1) + 2, COLOR_BLACK);
list.background_color = COLOR_WHITE;
list.text_color = COLOR_BLACK;
list.selected.background_color = IsDithered()
? COLOR_VERY_LIGHT_GRAY : COLOR_XCSOAR_LIGHT;
list.selected.text_color = COLOR_BLACK;
list.focused.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR;
list.focused.text_color = COLOR_WHITE;
list.pressed.background_color = COLOR_YELLOW;
list.pressed.text_color = COLOR_BLACK;
list.font = &text_font;
list.font_bold = &bold_font;
}
示例3: 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;
}