本文整理汇总了C++中FontStyle::Face方法的典型用法代码示例。如果您正苦于以下问题:C++ FontStyle::Face方法的具体用法?C++ FontStyle::Face怎么用?C++ FontStyle::Face使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontStyle
的用法示例。
在下文中一共展示了FontStyle::Face方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shear
/*!
\brief Constructor
\param style Style object to which the ServerFont belongs
\param size Character size in points
\param rotation Rotation in degrees
\param shear Shear (slant) in degrees. 45 <= shear <= 135
\param flags Style flags as defined in <Font.h>
\param spacing String spacing flag as defined in <Font.h>
*/
ServerFont::ServerFont(FontStyle& style, float size, float rotation,
float shear, float falseBoldWidth, uint16 flags, uint8 spacing)
:
fStyle(&style),
fSize(size),
fRotation(rotation),
fShear(shear),
fFalseBoldWidth(falseBoldWidth),
fBounds(0, 0, 0, 0),
fFlags(flags),
fSpacing(spacing),
fDirection(style.Direction()),
fFace(style.Face()),
fEncoding(B_UNICODE_UTF8)
{
fStyle->Acquire();
}
示例2:
FontStyle*
FontFamily::GetStyleMatchingFace(uint16 face) const
{
// TODO: support other faces (strike through, underlined, outlines...)
face &= B_BOLD_FACE | B_ITALIC_FACE | B_REGULAR_FACE | B_CONDENSED_FACE
| B_LIGHT_FACE | B_HEAVY_FACE;
int32 count = fStyles.CountItems();
for (int32 i = 0; i < count; i++) {
FontStyle* style = fStyles.ItemAt(i);
if (style->Face() == face)
return style;
}
return NULL;
}
示例3: FamilyID
status_t
ServerFont::SetFace(uint16 face)
{
// TODO: This needs further investigation. The face variable is actually
// flags, but some of them are not enforcable at the same time. Also don't
// confuse the Be API "face" with the Freetype face, which is just an
// index in case a single font file exports multiple font faces. The
// FontStyle class takes care of mapping the font style name to the Be
// API face flags in FontStyle::_TranslateStyleToFace().
FontStyle* style = NULL;
uint16 familyID = FamilyID();
if (gFontManager->Lock()) {
int32 count = gFontManager->CountStyles(familyID);
for (int32 i = 0; i < count; i++) {
style = gFontManager->GetStyleByIndex(familyID, i);
if (style == NULL)
break;
if (style->Face() == face) {
style->Acquire();
break;
} else
style = NULL;
}
gFontManager->Unlock();
}
if (!style)
return B_ERROR;
SetStyle(style);
style->Release();
return B_OK;
}