本文整理汇总了C++中FontInfo::SetFaceName方法的典型用法代码示例。如果您正苦于以下问题:C++ FontInfo::SetFaceName方法的具体用法?C++ FontInfo::SetFaceName怎么用?C++ FontInfo::SetFaceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontInfo
的用法示例。
在下文中一共展示了FontInfo::SetFaceName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawLyricString
void View::DrawLyricString ( DeviceContext *dc, int x, int y, std::wstring s, int staffSize)
{
assert( dc );
dc->StartText( ToDeviceContextX( x ), ToDeviceContextY( y ) );
std::wistringstream iss( s );
std::wstring token;
while( std::getline( iss, token, L'_' ))
{
dc->DrawText( UTF16to8( token.c_str() ), token );
// no _
if (iss.eof())
break;
FontInfo vrvTxt;
vrvTxt.SetFaceName("VerovioText");
vrvTxt.SetPointSize( m_doc->GetDrawingLyricFont(staffSize)->GetPointSize() );
dc->SetFont( &vrvTxt );
dc->VrvTextFont();
std::wstring str;
str.push_back(VRV_TEXT_E551);
dc->DrawText( UTF16to8( str.c_str() ), str );
dc->ResetFont();
}
//std::wcout << std::endl;
dc->EndText( );
}
示例2: DrawHarmString
void View::DrawHarmString(DeviceContext *dc, int x, int y, std::wstring s)
{
assert(dc);
std::size_t prev_pos = 0, pos;
while ((pos = s.find_first_of(L"\u266D\u266E\u266F", prev_pos)) != std::wstring::npos) {
// If pos is > than the previous, it is the substring to extract
if (pos > prev_pos) {
std::wstring substr = s.substr(prev_pos, pos - prev_pos);
dc->DrawText(UTF16to8(substr), substr);
}
// if it is the same or we still have space, it is the accidental
if (pos == prev_pos || pos < s.length()) {
// Then the accidental
std::wstring accid = s.substr(pos, 1);
std::wstring smufl_accid;
if (accid == L"\u266D") { // MUSIC FLAT SIGN
smufl_accid.push_back(SMUFL_E260_accidentalFlat);
}
else if (accid == L"\u266E") { // MUSIC NATURAL SIGN
smufl_accid.push_back(SMUFL_E261_accidentalNatural);
}
else if (accid == L"\u266F") { // MUSIC SHARP SIGN
smufl_accid.push_back(SMUFL_E262_accidentalSharp);
}
else {
smufl_accid.push_back(0xE26D);
}
FontInfo vrvTxt;
vrvTxt.SetFaceName("VerovioText");
dc->SetFont(&vrvTxt);
dc->DrawText(UTF16to8(smufl_accid), smufl_accid);
dc->ResetFont();
}
// Skip the accidental and continue
prev_pos = pos + 1;
}
// Print the remainder of the string, or the full string if no accid
if (prev_pos < s.length()) {
std::wstring substr = s.substr(prev_pos, std::wstring::npos);
dc->DrawText(UTF16to8(substr), substr);
}
}