-
-
Notifications
You must be signed in to change notification settings - Fork 991
/
text_formatting.hpp
54 lines (42 loc) · 1.39 KB
/
text_formatting.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
Copyright (C) 2003 - 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef TEXT_FORMATTING_HPP_INCLUDED
#define TEXT_FORMATTING_HPP_INCLUDED
#include "color.hpp"
#include <SDL.h>
#include <string>
/**
* Collection of helper functions relating to Pango formatting.
*/
namespace font {
/**
* Retuns a Pango formatting string using the provided color_t object.
*
* The string returned will be in format: '<span foreground=#color>'
* Callers will need to manually append the closing</span>' tag.
*
* @param color The color_t object from which to retrieve the color.
*/
std::string span_color(const color_t& color);
/**
* Returns a hex color string from a color range.
*
* @param id The id of the color range.
*/
std::string get_pango_color_from_id(const std::string& id);
/**
* Returns the name of a color range, colored with its own color.
*
* @param id The id of the color range.
*/
std::string get_color_string_pango(const std::string& id);
}
#endif