xtd - Reference Guide 0.2.0
font_family.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <memory>
7 #include <ostream>
8 #include <stdexcept>
9 #include <vector>
10 #include <xtd/object.h>
11 #include <xtd/ustring.h>
12 #include "../drawing_export.h"
13 #include "font_style.h"
15 
17 namespace xtd {
19  namespace drawing {
21  namespace text {
22  class font_collection;
23  }
25 
37  class drawing_export_ font_family final : public xtd::object {
38  public:
40 
45  explicit font_family(const xtd::ustring& name);
46 
50 
55  font_family(const xtd::ustring& name, const text::font_collection& font_collection);
57 
59  ~font_family();
60  font_family(const font_family& value);
61  font_family() = default;
62  font_family& operator =(const font_family& value);
63  bool operator ==(const font_family& value) const {return data_->name_ == value.data_->name_;}
64  bool operator !=(const font_family& value) const {return !operator ==(value);}
66 
68 
72  static std::vector<font_family> families();
73 
77 
81 
85 
88  const xtd::ustring& name() const {return data_->name_;}
90 
92 
97  int32_t get_cell_ascent(font_style style) const;
98 
102  int32_t get_cell_descent(font_style style) const;
103 
107  int32_t get_em_height(font_style style) const;
108 
112  int32_t get_line_spacing(font_style style) const;
113 
118  xtd::ustring get_name(int32_t language) const;
119 
123  bool is_style_available(font_style style) const;
124 
127  xtd::ustring to_string() const noexcept override {return ustring::format("[{}: name={}]", ustring::class_name(*this), data_->name_);}
129 
130  private:
131  struct data {
132  intptr_t handle_ = 0;
133  xtd::ustring name_;
134  };
135  std::shared_ptr<data> data_ = std::make_shared<data>();
136  };
137  }
138 }
static font_family generic_sans_serif()
Gets a generic sans serif font_family.
Definition: font_family.h:80
Defines a group of type faces having a similar basic design and certain variations in styles...
Definition: font_family.h:37
Contains xtd::drawing::font_style enum class.
generic_font_families
Specifies a generic font_family object.
Definition: generic_font_families.h:19
Provides a base class for installed and private font collections.
Definition: font_collection.h:22
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
A generic Serif font_family object.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:51
A generic Sans Serif font_family object.
xtd::ustring to_string() const noexcept override
Converts this font_family to a human-readable string representation.
Definition: font_family.h:127
Contains xtd::ustring class.
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30
font_style
Specifies style information applied to text. This enumeration has a flags attribute that allows a bit...
Definition: font_style.h:17
static ustring class_name()
Gets the class name of the object_t.
Definition: ustring.h:459
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: ustring.h:706
const xtd::ustring & name() const
Gets the name of this font_family.
Definition: font_family.h:88
A generic Monospace font_family object.
The xtd::forms::status_bar_panel displays text in the standard font.
static font_family generic_serif()
Gets a generic serif font_family.
Definition: font_family.h:84
static font_family generic_monospace()
Gets a generic monospace font_family.
Definition: font_family.h:76
Contains xtd::drawing::text::generic_font_families enum class.