xtd 0.2.0
font.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../drawing_export.hpp"
6#include "font_family.hpp"
7#include "graphics_unit.hpp"
8#include <xtd/iequatable>
9#include <xtd/object>
10#include <xtd/string>
11#include <cstdint>
12#include <memory>
13#include <ostream>
14#include <stdexcept>
15#include <vector>
16
18namespace 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
57 font(const font& prototype, float em_size);
58
63 font(const font& prototype, float em_size, font_style style);
64
68 font(const font& prototype, font_style style);
69
79 font(xtd::string family_name, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set, bool gdi_vertical_font);
80
90 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);
91
100 font(xtd::string family_name, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set);
101
110 font(const drawing::font_family& font_family, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set);
111
118 font(xtd::string family_name, float em_size, font_style style, graphics_unit unit);
119
126 font(const drawing::font_family& font_family, float em_size, font_style style, graphics_unit unit);
127
133 font(xtd::string family_name, float em_size, font_style style);
134
140 font(const drawing::font_family& font_family, float em_size, font_style style);
141
147 font(xtd::string family_name, float em_size, graphics_unit unit);
148
155
160 font(xtd::string family_name, float em_size);
161
166 font(const drawing::font_family& font_family, float em_size);
168
170 font(const font& value);
171 font& operator =(const font& value);
172 ~font();
174
176
180 bool bold() const noexcept;
181
185 drawing::font_family font_family() const noexcept;
186
212 xtd::byte gdi_char_set() const noexcept;
213
218 bool gdi_vertical_font() const noexcept;
219
222 intptr handle() const noexcept;
223
230 int32 height() const noexcept;
231
235 bool is_system_font() const noexcept;
236
239 bool italic() const noexcept;
240
243 const xtd::string& name() const noexcept;
244
247 const xtd::string& original_font_name() const noexcept;
248
251 float size() const noexcept;
252
255 float size_in_points() const noexcept;
256
259 bool strikeout() const noexcept;
260
263 font_style style() const noexcept;
264
267 bool underline() const noexcept;
268
271 graphics_unit unit() const noexcept;
273
275
280 bool equals(const xtd::object& obj) const noexcept override;
284 bool equals(const font& other) const noexcept override;
285
288 xtd::size get_hash_code() const noexcept override;
289
294 float get_height() const;
295
301 float get_height(const graphics& graphics) const;
302
307 float get_height(float dpi) const;
308
312 intptr to_hfont() const;
313
316 xtd::string to_string() const noexcept override;
318
320
325 static font from_hdc(const intptr hdc);
326
330 static font from_hfont(const intptr hfont);
332
333 private:
334 friend class graphics;
335 friend class system_fonts;
336 friend class xtd::forms::native::font_dialog;
337 explicit font(intptr hfont);
338
339 xtd::sptr<data> data_;
340 };
341 }
342}
Represents text as a sequence of character units.
Definition basic_string.hpp:71
Defines a group of type faces having a similar basic design and certain variations in styles....
Definition font_family.hpp:33
Defines a particular format for text, including font face, size, and style attributes....
Definition font.hpp:45
font(const font &prototype, float em_size)
Initializes a new xtd::drawing::font that uses the specified existing xtd::drawing::font and size.
font(xtd::string family_name, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set, bool gdi_vertical_font)
Initializes a new xtd::drawing::font using the specified size, style, unit, and character set.
font(const drawing::font_family &font_family, float em_size, font_style style, graphics_unit unit)
Initializes a new xtd::drawing::font using the specified size, style and unit.
font(const drawing::font_family &font_family, float em_size, graphics_unit unit)
Initializes a new xtd::drawing::font using the specified size and unit.
font(const drawing::font_family &font_family, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set)
Initializes a new xtd::drawing::font using the specified size, style, unit, and character set.
font(xtd::string family_name, float em_size, font_style style, graphics_unit unit, xtd::byte gdi_char_set)
Initializes a new xtd::drawing::font using the specified size, style, unit, and character set.
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)
Initializes a new xtd::drawing::font using the specified size, style, unit, and character set.
font(xtd::string family_name, float em_size, graphics_unit unit)
Initializes a new xtd::drawing::font using the specified size and unit.
font(const drawing::font_family &font_family, float em_size, font_style style)
Initializes a new xtd::drawing::font using the specified size and style.
font(const font &prototype, float em_size, font_style style)
Initializes a new xtd::drawing::font that uses the specified existing xtd::drawing::font,...
font(const drawing::font_family &font_family, float em_size)
Initializes a new xtd::drawing::font using the specified size.
font(xtd::string family_name, float em_size)
Initializes a new xtd::drawing::font using the specified size and unit.
font()
Initializes a new xtd::drawing::font.
font(const font &prototype, font_style style)
Initializes a new xtd::drawing::font that uses the specified existing xtd::drawing::font and font_sty...
font(xtd::string family_name, float em_size, font_style style)
Initializes a new xtd::drawing::font using the specified size and style.
bool bold() const noexcept
Gets a value that indicates whether this xtd::drawing::font is bold.
font(xtd::string family_name, float em_size, font_style style, graphics_unit unit)
Initializes a new xtd::drawing::font using the specified size, style and unit.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.hpp:67
Specifies the fonts used to display text in Windows display elements.
Definition system_fonts.hpp:25
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
Contains xtd::drawing::font_family class.
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.hpp:17
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
graphics_unit
Specifies the unit of measure for the given data. This enumeration has a flags attribute that allows ...
Definition graphics_unit.hpp:17
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31