ClanLib  2.3.7
font_description.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 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 
32 
33 #pragma once
34 
35 #include "../api_display.h"
36 #include "../../Core/Text/string_types.h"
37 #include "../../Core/System/sharedptr.h"
38 
39 class CL_DisplayWindow;
40 class CL_FontDescription_Impl;
41 
47 {
50 
51 public:
54 
55  virtual ~CL_FontDescription();
56 
60  static CL_FontDescription create_null_object();
61 
65 
66 public:
67 
68  enum Charset
69  {
88  charset_thai
89  };
90 
92  bool is_null() const { return !impl; }
93 
95  void throw_if_null() const;
96 
98  const CL_String &get_typeface_name() const;
99 
101  int get_height() const;
102 
104  int get_average_width() const;
105 
107  float get_escapement() const;
108 
110  float get_orientation() const;
111 
113  int get_weight() const;
114 
116  bool get_italic() const;
117 
119  bool get_underline() const;
120 
122  bool get_strikeout() const;
123 
125  bool get_fixed_pitch() const;
126 
128  bool get_anti_alias() const;
129 
131  bool get_subpixel() const;
132 
134  Charset get_charset() const;
135 
137  bool operator==(const CL_FontDescription &other) const;
138 
142 
143 public:
145  CL_FontDescription &operator =(const CL_FontDescription &copy);
146 
147  // \brief Copy the entire font description (not just the implementation)
148  void clone(const CL_FontDescription &copy);
149 
151  void set_typeface_name(const CL_String &name);
152 
154  void set_height(int value);
155 
157  void set_average_width(int value);
158 
160  void set_escapement(float value);
161 
163  void set_orientation(float value);
164 
166  void set_weight(int value);
167 
169  void set_italic(bool setting = true);
170 
172  void set_underline(bool setting = true);
173 
175  void set_strikeout(bool setting = true);
176 
178  void set_fixed_pitch(bool setting = true);
179 
181  void set_anti_alias(bool setting = true);
182 
184  void set_subpixel(bool setting = true);
185 
189  void set_charset(Charset new_charset);
190 
194 
195 private:
196  CL_SharedPtr<CL_FontDescription_Impl> impl;
198 };
199 
201