xtd 0.2.0
font.h
Go to the documentation of this file.
1 #pragma once
5 #include "../drawing_export.h"
6 #include "font_family.h"
7 #include "graphics_unit.h"
8 #include <xtd/iequatable>
9 #include <xtd/object>
10 #include <xtd/ustring>
11 #include <cstdint>
12 #include <memory>
13 #include <ostream>
14 #include <stdexcept>
15 #include <vector>
16 
18 namespace xtd {
20  namespace forms {
21  namespace native {
22  class font_dialog;
23  }
24  }
26 
28  namespace drawing {
30  class graphics;
31  class system_fonts;
33 
45  class drawing_export_ font final : public xtd::object, public xtd::iequatable<font> {
46  struct data;
47 
48  public:
50 
55  font(const font& prototype, float em_size);
56 
61  font(const font& prototype, float em_size, font_style style);
62 
66  font(const font& prototype, font_style style);
67 
77  font(xtd::ustring family_name, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set, bool gdi_vertical_font);
78 
88  font(const drawing::font_family& font_family, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set, bool gdi_vertical_font);
89 
98  font(xtd::ustring family_name, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set);
99 
108  font(const drawing::font_family& font_family, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set);
109 
116  font(xtd::ustring family_name, float em_size, font_style style, graphics_unit unit);
117 
124  font(const drawing::font_family& font_family, float em_size, font_style style, graphics_unit unit);
125 
131  font(xtd::ustring family_name, float em_size, font_style style);
132 
138  font(const drawing::font_family& font_family, float em_size, font_style style);
139 
145  font(xtd::ustring family_name, float em_size, graphics_unit unit);
146 
152  font(const drawing::font_family& font_family, float em_size, graphics_unit unit);
153 
158  font(xtd::ustring family_name, float em_size);
159 
164  font(const drawing::font_family& font_family, float em_size);
166 
168  font(const font& value);
169  font& operator =(const font& value);
170  ~font();
172 
174 
178  bool bold() const noexcept;
179 
183  drawing::font_family font_family() const noexcept;
184 
210  xtd::byte gdi_char_set() const noexcept;
211 
216  bool gdi_vertical_font() const noexcept;
217 
220  intptr handle() const noexcept;
221 
228  int32 height() const noexcept;
229 
233  bool is_system_font() const noexcept;
234 
237  bool italic() const noexcept;
238 
241  const xtd::ustring& name() const noexcept;
242 
245  const xtd::ustring& original_font_name() const noexcept;
246 
249  float size() const noexcept;
250 
253  float size_in_points() const noexcept;
254 
257  bool strikeout() const noexcept;
258 
261  font_style style() const noexcept;
262 
265  bool underline() const noexcept;
266 
269  graphics_unit unit() const noexcept;
271 
273 
275  bool equals(const font& value) const noexcept override;
276 
280  static font from_hdc(const intptr hdc);
281 
285  static font from_hfont(const intptr hfont);
286 
291  float get_height() const;
292 
298  float get_height(const graphics& graphics) const;
299 
304  float get_height(float dpi) const;
305 
309  intptr to_hfont() const;
310 
313  xtd::ustring to_string() const noexcept override;
315 
316  private:
317  friend class graphics;
318  friend class system_fonts;
319  friend class xtd::forms::native::font_dialog;
320  font();
321  explicit font(intptr hfont);
322 
323  std::shared_ptr<data> data_;
324  };
325  }
326 }
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
Definition: font.h:45
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
Defines a group of type faces having a similar basic design and certain variations in styles...
Definition: font_family.h:38
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Specifies the fonts used to display text in Windows display elements.
Definition: system_fonts.h:25
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
Text with a line through the middle.
Contains xtd::drawing::font_family class.
Specifies that the height of the control is defined.
Specifies that both the width and height property values of the control are defined.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Contains xtd::drawing::graphics_unit enum class.
font_style
Specifies style information applied to text. This enumeration has a flags attribute that allows a bit...
Definition: font_style.h:17
graphics_unit
Specifies the unit of measure for the given data. This enumeration has a flags attribute that allows ...
Definition: graphics_unit.h:17
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics.h:70
uint_least8_t byte
Represents a 8-bit unsigned integer.
Definition: types.h:39