16 #define GETTEXT_DOMAIN "wesnoth-lib"
35 }
else if(style ==
"italic") {
37 }
else if(style ==
"underline") {
41 if(!style.empty() && style !=
"normal") {
42 ERR_GUI_G <<
"Unknown style '" << style <<
"', using 'normal' instead.";
55 if(weight ==
"thin") {
56 return PANGO_WEIGHT_THIN;
57 }
else if (weight ==
"light") {
58 return PANGO_WEIGHT_LIGHT;
59 }
else if (weight ==
"semibold") {
60 return PANGO_WEIGHT_SEMIBOLD;
61 }
else if (weight ==
"bold") {
62 return PANGO_WEIGHT_BOLD;
63 }
else if (weight ==
"heavy") {
64 return PANGO_WEIGHT_HEAVY;
67 if(!weight.empty() && weight !=
"normal") {
68 ERR_GUI_E <<
"Invalid text weight '" << weight <<
"', falling back to 'normal'.";
71 return PANGO_WEIGHT_NORMAL;
76 if(style ==
"italic") {
77 return PANGO_STYLE_ITALIC;
78 }
else if(style ==
"oblique") {
79 return PANGO_STYLE_OBLIQUE;
82 if(!style.empty() && style !=
"normal") {
83 ERR_GUI_E <<
"Invalid text style '" << style <<
"', falling back to 'normal'.";
86 return PANGO_STYLE_NORMAL;
91 if(alignment ==
"center") {
92 return PANGO_ALIGN_CENTER;
93 }
else if(alignment ==
"right") {
94 return PANGO_ALIGN_RIGHT;
97 if(!alignment.empty() && alignment !=
"left") {
98 ERR_GUI_E <<
"Invalid text alignment '" << alignment <<
"', falling back to 'left'.";
101 return PANGO_ALIGN_LEFT;
107 case PANGO_ALIGN_LEFT:
109 case PANGO_ALIGN_RIGHT:
111 case PANGO_ALIGN_CENTER:
117 throw "Control should not reach this point.";
122 return t_string(
VGETTEXT(
"Mandatory widget ‘$id’ hasn't been defined.", {{
"id",
id}}));
150 return text.substr(0, 15);
Define the common log macros for the gui toolkit.
unsigned screen_width
The screen resolution and pixel pitch should be available for all widgets since their drawing method ...
const unsigned screen_pitch_microns
screen_pitch_microns is deprecated.
unsigned gamemap_x_offset
The offset between the left edge of the screen and the gamemap.
unsigned gamemap_width
The size of the map area, if not available equal to the screen size.
void get_screen_size_variables(wfl::map_formula_callable &variable)
Gets a formula object with the screen size.
color_t decode_color(const std::string &color)
Converts a color string to a color.
t_string missing_widget(const std::string &id)
Returns a default error message if a mandatory widget is omitted.
point get_mouse_position()
Returns the current mouse position.
std::string_view debug_truncate(std::string_view text)
Returns a truncated version of the text.
PangoWeight decode_text_weight(const std::string &weight)
Converts a text weight string to a PangoWeight.
font::pango_text::FONT_STYLE decode_font_style(const std::string &style)
Converts a font style string to a font style.
PangoAlignment decode_text_alignment(const std::string &alignment)
Converts a text alignment string to a text alignment.
PangoStyle decode_text_style(const std::string &style)
Converts a text style string to a PangoStyle.
std::string encode_text_alignment(const PangoAlignment alignment)
Converts a text alignment to its string representation.
point get_mouse_location()
Returns the current mouse location in draw space.
This file contains the settings handling of the widget library.
The basic class for representing 8-bit RGB or RGBA colour values.
static color_t from_rgba_string(std::string_view c)
Creates a new color_t object from a string variable in "R,G,B,A" format.