xtd 0.2.0
font.cpp

Shows how to use xtd::drawing::font class.

#include <xtd/drawing/font>
#include <xtd/console>
using namespace xtd;
using namespace xtd::drawing;
auto main() -> int {
console::write_line("font1 = {0}", font1);
auto font2 = font {"Times New Roman", 24.0f};
console::write_line("font2 = {0}", font2);
auto font3 = font {font_family::generic_serif(), 24.0f};
console::write_line("font3 = {0}", font3);
console::write_line("font1 {0} font2", font1 == font2 ? "==" : "!=");
console::write_line("font2 {0} font3", font2 == font3 ? "==" : "!=");
}
// This code can produce the following output :
//
// font1 = [font: name=Courier, size=42, units=3, gdi_char_set=0, gdi_vertical_font=false]
// font2 = [font: name=Times, size=24, units=3, gdi_char_set=0, gdi_vertical_font=false]
// font3 = [font: name=Times New Roman, size=24, units=3, gdi_char_set=0, gdi_vertical_font=false]
// font1 != font2
// font2 == font3
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static font_family generic_monospace() noexcept
Gets a generic monospace font_family.
static font_family generic_serif() noexcept
Gets a generic serif font_family.
Defines a particular format for text, including font face, size, and style attributes....
Definition font.hpp:45
@ bold
Bold text.
Definition font_style.hpp:21
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8