xtd 1.0.0
Loading...
Searching...
No Matches
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 [[nodiscard]] auto bold() const noexcept -> bool;
181
185 [[nodiscard]] auto font_family() const noexcept -> xtd::drawing::font_family;
186
212 [[nodiscard]] auto gdi_char_set() const noexcept -> xtd::byte;
213
218 [[nodiscard]] auto gdi_vertical_font() const noexcept -> bool;
219
222 [[nodiscard]] auto handle() const noexcept -> xtd::intptr;
223
230 [[nodiscard]] auto height() const noexcept -> xtd::int32;
231
235 [[nodiscard]] auto is_system_font() const noexcept -> bool;
236
239 [[nodiscard]] auto italic() const noexcept -> bool;
240
243 [[nodiscard]] auto name() const noexcept -> const xtd::string&;
244
247 [[nodiscard]] auto original_font_name() const noexcept -> const xtd::string&;
248
251 [[nodiscard]] auto size() const noexcept -> float;
252
255 [[nodiscard]] auto size_in_points() const noexcept -> float;
256
259 [[nodiscard]] auto strikeout() const noexcept -> bool;
260
263 [[nodiscard]] auto style() const noexcept -> xtd::drawing::font_style;
264
267 [[nodiscard]] auto underline() const noexcept -> bool;
268
271 [[nodiscard]] auto unit() const noexcept -> xtd::drawing::graphics_unit;
273
275
280 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
284 [[nodiscard]] auto equals(const font& other) const noexcept -> bool override;
285
288 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
289
294 [[nodiscard]] auto get_height() const -> float;
295
301 [[nodiscard]] auto get_height(const graphics& graphics) const -> float;
302
307 [[nodiscard]] auto get_height(float dpi) const -> float;
308
312 [[nodiscard]] auto to_hfont() const -> xtd::intptr;
313
316 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
318
320
325 [[nodiscard]] static auto from_hdc(const intptr hdc) -> font;
326
330 [[nodiscard]] static auto from_hfont(const intptr hfont) -> font;
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
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.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
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.
auto underline() const noexcept -> bool
Gets a value that indicates whether this xtd::drawing::font is underline.
auto gdi_vertical_font() const noexcept -> bool
Gets a Boolean value that indicates whether this xtd::drawing::font is derived from a GDI vertical fo...
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,...
auto to_string() const noexcept -> xtd::string override
Converts this font_family to a human-readable string representation.
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.
auto height() const noexcept -> xtd::int32
Gets the line spacing of this font.
auto handle() const noexcept -> xtd::intptr
Gets the window handle that the font is bound to.
auto to_hfont() const -> xtd::intptr
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.
auto size_in_points() const noexcept -> float
Gets the em-size, in points, of this xtd::drawing::font.
auto style() const noexcept -> xtd::drawing::font_style
Gets style information for this xtd::drawing::font.
auto size() const noexcept -> float
Gets the em-size of this xtd::drawing::font measured in the units specified by the unit property.
auto gdi_char_set() const noexcept -> xtd::byte
Gets a byte value that specifies the GDI character set that this xtd::drawing::font uses.
auto italic() const noexcept -> bool
Gets a value that indicates whether this xtd::drawing::font is italic.
auto font_family() const noexcept -> xtd::drawing::font_family
Gets the xtd::drawing::font_family associated with this xtd::drawing::font.
auto bold() const noexcept -> bool
Gets a value that indicates whether this xtd::drawing::font is bold.
auto unit() const noexcept -> xtd::drawing::graphics_unit
Gets the unit of measure for this xtd::drawing::font.
auto is_system_font() const noexcept -> bool
Gets a value indicating whether the font is a member of xtd::drawing::system_fonts.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto name() const noexcept -> const xtd::string &
Gets the face name of this xtd::drawing::font.
static auto from_hdc(const intptr hdc) -> font
Creates a font from the specified Windows handle to a device context.
static auto from_hfont(const intptr hfont) -> font
Creates a font from the specified Windows handle.
auto original_font_name() const noexcept -> const xtd::string &
Gets the face name of this Font.
auto get_height() const -> float
Returns the line spacing, in pixels, of this font.
auto strikeout() const noexcept -> bool
Gets a value that indicates whether this xtd::drawing::font is strikeout.
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:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
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
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
std::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::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 auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197