1 #include "lxgui/gui_font_string.hpp"
2 #include "lxgui/gui_layout_node.hpp"
3 #include "lxgui/gui_localizer.hpp"
4 #include "lxgui/gui_manager.hpp"
5 #include "lxgui/gui_out.hpp"
15 parse_shadow_node_(node);
18 void font_string::parse_attributes_(
const layout_node& node) {
35 std::string outline = utils::to_lower(attr.value());
36 if (outline ==
"normal" || outline ==
"thick") {
39 }
else if (outline ==
"none")
43 <<
"Unknown outline type for " <<
name_ <<
": \"" << outline <<
"\"."
57 void font_string::parse_shadow_node_(
const layout_node& node) {
58 if (
const layout_node* shadow_node = node.try_get_child(
"Shadow")) {
61 if (
const layout_node* color_node = shadow_node->try_get_child(
"Color"))
64 if (
const layout_node* offset_node = shadow_node->try_get_child(
"Offset")) {
void set_non_space_wrap_enabled(bool enabled)
Sets whether large text without whitespace is truncated or wrapped.
void set_shadow_color(const color &shadow_color)
Sets this font_string's shadow color.
void set_line_spacing(float line_spacing)
Sets the space between each line as a fraction of the font height.
void set_alignment_x(alignment_x align_x)
Sets this font_string's horizontal alignment behavior.
void enable_shadow()
Makes this font_string draw a shadow under its text.
void set_vertex_cache_strategy(vertex_cache_strategy strategy)
Selects the strategy for using vertex caches.
void set_alignment_y(alignment_y align_y)
Sets this font_string's vertical alignment behavior.
void set_outlined(bool outlined)
Adds or remove the outline around the text.
void set_shadow_offset(const vector2f &shadow_offset)
Sets this font_string's shadow offset.
void set_text(const utils::ustring &content)
Sets the rendered text.
void parse_layout(const layout_node &node) override
Parses data from a layout_node.
void set_text_color(const color &text_color)
Sets the text color.
void set_font(const std::string &font_name, float height)
Sets this font_string's font (file and size).
void set_spacing(float spacing)
Sets the space between each letter.
void parse_attributes_(const layout_node &node) override
void parse_layout(const layout_node &node) override
Parses data from a layout_node.
std::string_view get_location() const noexcept
Returns this node's location in the file as {file}:{line}.
An node in a layout file.
std::optional< std::string_view > try_get_attribute_value(std::string_view name) const noexcept
Returns the value of the attribute with the provided name, nullopt if not found.
const layout_node * try_get_child(std::string_view name) const noexcept
Returns the first child with a given name, or null if none.
T get_attribute_value_or(std::string_view name, T fallback) const noexcept
Returns the value of the attribute with the provided name, or a default if not found or parsing faile...
color parse_color_node_(const layout_node &node)
manager & get_manager()
Returns this region's manager.
vector2< float > parse_offset_node_or_(const layout_node &node, float fallback)
vertex_cache_strategy
Strategy for using a vertex cache.
const std::string warning