font_description.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Mark Page
27 ** Harry Storbacka
28 */
29 
30 
31 #pragma once
32 
33 #include "../api_display.h"
34 #include <memory>
35 
36 namespace clan
37 {
40 
41 class DisplayWindow;
42 class FontDescription_Impl;
43 
47 class CL_API_DISPLAY FontDescription
48 {
51 
52 public:
55 
57  FontDescription(const std::string &typeface_name);
58 
59  virtual ~FontDescription();
60 
64  static FontDescription create_null_object();
65 
69 
70 public:
71 
72  enum Charset
73  {
92  charset_thai
93  };
94 
96  bool is_null() const { return !impl; }
97 
99  void throw_if_null() const;
100 
102  const std::string &get_typeface_name() const;
103 
105  int get_height() const;
106 
108  int get_average_width() const;
109 
111  float get_escapement() const;
112 
114  float get_orientation() const;
115 
117  int get_weight() const;
118 
120  bool get_italic() const;
121 
123  bool get_underline() const;
124 
126  bool get_strikeout() const;
127 
129  bool get_fixed_pitch() const;
130 
132  bool get_anti_alias() const;
133 
135  bool get_subpixel() const;
136 
138  Charset get_charset() const;
139 
141  bool operator==(const FontDescription &other) const;
142 
146  std::string get_unique_id() const;
147 
151 
152 public:
154  FontDescription &operator =(const FontDescription &copy);
155 
156  // \brief Copy the entire font description (not just the implementation)
157  FontDescription clone() const;
158 
160  void set_typeface_name(const std::string &name);
161 
163  void set_height(int value);
164 
166  void set_average_width(int value);
167 
169  void set_escapement(float value);
170 
172  void set_orientation(float value);
173 
175  void set_weight(int value);
176 
178  void set_italic(bool setting = true);
179 
181  void set_underline(bool setting = true);
182 
184  void set_strikeout(bool setting = true);
185 
187  void set_fixed_pitch(bool setting = true);
188 
190  void set_anti_alias(bool setting = true);
191 
193  void set_subpixel(bool setting = true);
194 
198  void set_charset(Charset new_charset);
199 
203 
204 private:
205  std::shared_ptr<FontDescription_Impl> impl;
207 };
208 
209 }
210 
212 
Definition: font_description.h:81
Font description class.
Definition: font_description.h:47
Definition: font_description.h:82
Definition: font_description.h:84
Definition: font_description.h:87
Definition: font_description.h:85
Definition: font_description.h:80
Definition: font_description.h:78
Definition: font_description.h:75
Definition: font_description.h:89
Definition: font_description.h:77
bool is_null() const
Returns true if this object is invalid.
Definition: font_description.h:96
Definition: font_description.h:79
Definition: font_description.h:86
Definition: font_description.h:90
Definition: font_description.h:88
Definition: font_description.h:76
Definition: font_description.h:74
Definition: font_description.h:91
Charset
Definition: font_description.h:72
Definition: font_description.h:83