当前位置: 首页>>代码示例>>C++>>正文


C++ BFont::SetFamilyAndFace方法代码示例

本文整理汇总了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;
}
开发者ID:HaikuArchives,项目名称:XBeLib,代码行数:15,代码来源:FontList.cpp

示例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(&currentFamily, &currentStyle);

	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());
}
开发者ID:RTOSkit,项目名称:haiku,代码行数:48,代码来源:FontSelectionView.cpp


注:本文中的BFont::SetFamilyAndFace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。