FastUIDraw
font_properties.hpp
Go to the documentation of this file.
1 /*!
2  * \file font_properties.hpp
3  * \brief file font_properties.hpp
4  *
5  * Adapted from: WRATHFontDatabase.hpp of WRATH:
6  *
7  * Copyright 2013 by Nomovok Ltd.
8  * Contact: info@nomovok.com
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@nomovok.com>
16  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
17  *
18  */
19 
20 #ifndef FASTUIDRAW_FONT_PROPERTIES_HPP
21 #define FASTUIDRAW_FONT_PROPERTIES_HPP
22 
23 #include <fastuidraw/util/util.hpp>
24 
25 namespace fastuidraw
26 {
27 /*!\addtogroup Glyph
28  * @{
29  */
30 
31  /*!
32  * \brief
33  * Represents defining properties of a font
34  * used by FontDatabase to perform font
35  * merging.
36  */
38  {
39  public:
40  /*!
41  * Ctor. Initializes bold() as false,
42  * italic() as false and all string values
43  * as empty strings.
44  */
45  FontProperties(void);
46 
47  /*!
48  * Copy ctor.
49  * \param obj vaue from which to copy
50  */
51  FontProperties(const FontProperties &obj);
52 
53  ~FontProperties();
54 
55  /*!
56  * assignment operator
57  * \param obj value from which to assign
58  */
60  operator=(const FontProperties &obj);
61 
62  /*!
63  * Swap operation
64  * \param obj object with which to swap
65  */
66  void
67  swap(FontProperties &obj);
68 
69  /*!
70  * Specifies if the font is to be bold or not;
71  * this value is overridden by the value of
72  * style() if style() is a non-empty string.
73  */
74  bool
75  bold(void) const;
76 
77  /*!
78  * Set if the font is to be bold or not.
79  * \param b value to which to set bold(void) const
80  */
82  bold(bool b);
83 
84  /*!
85  * Specifies if the font is to be italic or not;
86  * this value is overridden by the value of
87  * style() if style() is a non-empty string.
88  */
89  bool
90  italic(void) const;
91 
92  /*!
93  * Set if the font is to be italic or not.
94  * \param b value to which to set italic(void) const
95  */
97  italic(bool b);
98 
99  /*!
100  * Specifies the style name of the font.
101  * Examples are "Bold", "Bold Italic",
102  * "Book", "Condensed", "Condensed Bold Obliquie".
103  * The value for style is NOT orthogonal to
104  * the value of italic() and bold().
105  * For example, under a standard GNU/Linux system
106  * the style names "Condensed Bold Oblique",
107  * "Condensed Oblique", "Condensed Bold"
108  * and "Condensed" give different fonts for
109  * the family name "DejaVu Serif". If style()
110  * is a non-empty string, the then it overrides
111  * both italic() and bold().
112  */
113  c_string
114  style(void) const;
115 
116  /*!
117  * Set the value returned by style(void) const
118  * \param s value to which to set style(void) const
119  */
121  style(c_string s);
122 
123  /*!
124  * Specifies the family name of the font, for example "Sans"
125  */
126  c_string
127  family(void) const;
128 
129  /*!
130  * Set the value returned by family(void) const
131  * \param s value to which to set family(void) const
132  */
134  family(c_string s);
135 
136  /*!
137  * Specifies the foundry name of the
138  * font, i.e. the maker of the font.
139  * Some systems (for example those using
140  * fontconfig) this value is ignored.
141  */
142  c_string
143  foundry(void) const;
144 
145  /*!
146  * Set the value returned by foundry(void) const
147  * \param s value to which to set foundry(void) const
148  */
150  foundry(c_string s);
151 
152  /*!
153  * Specifies the source of the font, for those
154  * fonts coming from file names should be a string
155  * giving the filename and face index with a
156  * colon seperating them, for example "foo:0"
157  * indicates from file foo and the face index
158  * is 0.
159  */
160  c_string
161  source_label(void) const;
162 
163  /*!
164  * Set the value returned by source_label(void) const
165  * \param s value to which to set source_label(void) const
166  */
169 
170  /*!
171  * Set the value returned by source_label(void) const
172  * to refer to a face index of a font file. Equivalent
173  * in function to
174  * \code
175  * std::ostringstream str;
176  * str << filename << ":" << face_index;
177  * source_label(str.str().c_str());
178  * \endcode
179  * \param filename name of file holding the font
180  * \param face_index index of face within the file.
181  */
183  source_label(c_string filename, int face_index);
184 
185  private:
186  void *m_d;
187  };
188 /*! @} */
189 }
190 
191 #endif
c_string source_label(void) const
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
Represents defining properties of a font used by FontDatabase to perform font merging.
bool italic(void) const
c_string family(void) const
file util.hpp
c_string foundry(void) const
void swap(FontProperties &obj)
c_string style(void) const
const char * c_string
Conveniant typedef for C-style strings.
Definition: util.hpp:135
FontProperties & operator=(const FontProperties &obj)