本文整理汇总了C++中BFont::SetFamilyAndFace方法的典型用法代码示例。如果您正苦于以下问题:C++ BFont::SetFamilyAndFace方法的具体用法?C++ BFont::SetFamilyAndFace怎么用?C++ BFont::SetFamilyAndFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFont
的用法示例。
在下文中一共展示了BFont::SetFamilyAndFace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_encoding
const char* get_encoding(font_family* family) {
static const char* latin = "iso8859-1";
static const char* hankaku = "jisx0201.1976-0";
static const char* kanji = "jisx0208.1983-0";
static const char* testchar = "\xEF\xBD\xB1\xE4\xBA\x9C";
static bool check[2];
static BFont font;
font.SetFamilyAndFace(*family, B_REGULAR_FACE);
font.GetHasGlyphs(testchar, 2, check);
if(check[1])
return kanji;
if(check[0])
return hankaku;
return latin;
}
示例2: BMessage
void
FontSelectionView::UpdateFontsMenu()
{
int32 numFamilies = count_font_families();
fFontsMenu->RemoveItems(0, fFontsMenu->CountItems(), true);
BFont font = fCurrentFont;
font_family currentFamily;
font_style currentStyle;
font.GetFamilyAndStyle(¤tFamily, ¤tStyle);
for (int32 i = 0; i < numFamilies; i++) {
font_family family;
uint32 flags;
if (get_font_family(i, &family, &flags) != B_OK)
continue;
// if we're setting the fixed font, we only want to show fixed fonts
if (!strcmp(Name(), "fixed") && (flags & B_IS_FIXED) == 0)
continue;
font.SetFamilyAndFace(family, B_REGULAR_FACE);
BMessage* message = new BMessage(kMsgSetFamily);
message->AddString("family", family);
message->AddString("name", Name());
BMenuItem* familyItem;
if (fStylesMenuField != NULL) {
familyItem = new BMenuItem(family, message);
} else {
// Each family item has a submenu with all styles for that font.
BMenu* stylesMenu = new BMenu(family);
_AddStylesToMenu(font, stylesMenu);
familyItem = new BMenuItem(stylesMenu, message);
}
familyItem->SetMarked(strcmp(family, currentFamily) == 0);
fFontsMenu->AddItem(familyItem);
familyItem->SetTarget(this);
}
// Separate styles menu for only the current font.
if (fStylesMenuField != NULL)
_AddStylesToMenu(fCurrentFont, fStylesMenuField->Menu());
}