本文整理汇总了C++中TextLine::SetTextUtf8方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLine::SetTextUtf8方法的具体用法?C++ TextLine::SetTextUtf8怎么用?C++ TextLine::SetTextUtf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine::SetTextUtf8方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
void XmlSceneParser::Parse (const ParseNode& decl, TextLine& node, Node& parent, SceneContext& context)
{
try
{
//предварительный разбор
TextLineDeclPtr node_decl = impl->PrepareTextLine (decl);
//настройка узла
node.SetTextUtf8 (node_decl->text.c_str ());
Impl::FontDeclMap::iterator font_decl_iter = impl->fonts_decls.find (node_decl->font.c_str ());
if (font_decl_iter == impl->fonts_decls.end ())
raise_parser_exception (decl, "Font '%s' is not defined", node_decl->font.c_str ());
FontDecl& font_decl = *font_decl_iter->second;
node.SetFont (get<const char*> (decl, "font_face", font_decl.face_name.c_str ()));
FontDpi* font_dpi = context.FindAttachment<FontDpi> ();
media::FontCreationParams font_creation_params = font_decl.creation_params;
if (font_dpi)
{
if (!font_creation_params.vertical_dpi)
font_creation_params.vertical_dpi = font_dpi->vertical_dpi;
if (!font_creation_params.horizontal_dpi)
font_creation_params.horizontal_dpi = font_dpi->horizontal_dpi;
}
//load font params overrides
font_creation_params.font_size = get<unsigned int> (decl, "font_size", font_creation_params.font_size);
font_creation_params.font_size_eps = get<unsigned int> (decl, "font_size_eps", font_creation_params.font_size_eps);
font_creation_params.weight = get<unsigned short> (decl, "font_weight", font_creation_params.weight);
font_creation_params.escapement = get<int> (decl, "font_escapement", font_creation_params.escapement);
font_creation_params.bold = xtl::xstrcmp (get<const char*> (decl, "font_bold", font_creation_params.bold ? "true" : "false"), "true") == 0;
font_creation_params.italic = xtl::xstrcmp (get<const char*> (decl, "font_italic", font_creation_params.italic ? "true" : "false"), "true") == 0;
font_creation_params.underlined = xtl::xstrcmp (get<const char*> (decl, "font_underlined", font_creation_params.underlined ? "true" : "false"), "true") == 0;
font_creation_params.striked = xtl::xstrcmp (get<const char*> (decl, "font_striked", font_creation_params.striked ? "true" : "false"), "true") == 0;
font_creation_params.stroke_size = get<unsigned int> (decl, "font_stroke_size", font_creation_params.stroke_size);
font_creation_params.vertical_dpi = get<unsigned short> (decl, "font_vertical_dpi", font_creation_params.vertical_dpi);
font_creation_params.horizontal_dpi = get<unsigned short> (decl, "font_horizontal_dpi", font_creation_params.horizontal_dpi);
font_creation_params.charset_name = get<const char*> (decl, "font_charset_name", font_creation_params.charset_name);
node.SetFontCreationParams (font_creation_params);
if (node_decl->horizontal_alignment.state) node.SetHorizontalAlignment (node_decl->horizontal_alignment.value);
if (node_decl->vertical_alignment.state) node.SetVerticalAlignment (node_decl->vertical_alignment.value);
math::vec4f color = node.Color ();
if (node_decl->color.state) color = node_decl->color.value;
if (node_decl->alpha.state) color.w = node_decl->alpha.value;
node.SetColor (color);
//разбор родительских параметров
Parse (decl, static_cast<Entity&> (node), parent, context);
}
catch (xtl::exception& e)
{
e.touch ("scene_graph::XmlSceneParser::Parse(const ParseNode&,TextLine&,Node&,SceneContext&)");
throw;
}
}