xtd 0.2.0
font.hpp
Go to the documentation of this file.
1
4#pragma once
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
80
91
101
111
118 font(xtd::string family_name, float em_size, font_style style, graphics_unit unit);
119
127
133 font(xtd::string family_name, float em_size, font_style style);
134
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
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}
Defines a group of type faces having a similar basic design and certain variations in styles....
Definition font_family.hpp:33
drawing::font_family font_family() const noexcept
Gets the xtd::drawing::font_family associated with this xtd::drawing::font.
xtd::string to_string() const noexcept override
Converts this font_family to a human-readable string representation.
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.
xtd::byte gdi_char_set() const noexcept
Gets a byte value that specifies the GDI character set that this xtd::drawing::font uses.
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.
bool is_system_font() const noexcept
Gets a value indicating whether the font is a member of xtd::drawing::system_fonts.
graphics_unit unit() const noexcept
Gets the unit of measure for this xtd::drawing::font.
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,...
float size_in_points() const noexcept
Gets the em-size, in points, of this xtd::drawing::font.
bool italic() const noexcept
Gets a value that indicates whether this xtd::drawing::font is italic.
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.
const xtd::string & name() const noexcept
Gets the face name of this xtd::drawing::font.
static font from_hdc(const intptr hdc)
Creates a font from the specified Windows handle to a device context.
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 strikeout() const noexcept
Gets a value that indicates whether this xtd::drawing::font is strikeout.
bool underline() const noexcept
Gets a value that indicates whether this xtd::drawing::font is underline.
static font from_hfont(const intptr hfont)
Creates a font from the specified Windows handle.
bool bold() const noexcept
Gets a value that indicates whether this xtd::drawing::font is bold.
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
float size() const noexcept
Gets the em-size of this xtd::drawing::font measured in the units specified by the unit property.
int32 height() const noexcept
Gets the line spacing of this font.
intptr handle() const noexcept
Gets the window handle that the font is bound to.
font_style style() const noexcept
Gets style information for this xtd::drawing::font.
float get_height() const
Returns the line spacing, in pixels, of this font.
intptr to_hfont() const
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.
const xtd::string & original_font_name() const noexcept
Gets the face name of this Font.
bool gdi_vertical_font() const noexcept
Gets a Boolean value that indicates whether this xtd::drawing::font is derived from a GDI vertical fo...
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:44
Contains drawing_export_ keyword.
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
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
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
@ other
The operating system is other.
Definition platform_id.hpp:58
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::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201