HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
text_style.hpp
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "font_variant.hpp"
8#include "text_decoration.hpp"
9#include "font_family_id.hpp"
10#include "../color/color.hpp"
11#include "../numbers.hpp"
12#include <format>
13#include <ostream>
14
15namespace hi::inline v1 {
16class font_book;
17
18struct text_style {
19 font_family_id family_id;
20 font_variant variant;
21 float size;
23 text_decoration decoration;
24
25 text_style() noexcept : family_id(), variant(), size(0.0), color(), decoration(text_decoration::None) {}
26
28 hi::font_family_id family_id,
29 hi::font_variant variant,
30 float size,
31 hi::color color,
32 text_decoration decoration) noexcept :
33 family_id(family_id), variant(variant), size(size), color(color), decoration(decoration)
34 {
35 }
36
37 text_style(text_style const &) noexcept = default;
38 text_style(text_style &&) noexcept = default;
39 text_style &operator=(text_style const &) noexcept = default;
40 text_style &operator=(text_style &&) noexcept = default;
41
42 [[nodiscard]] friend std::string to_string(text_style const &rhs) noexcept
43 {
44 // XXX - fmt:: no longer can format tagged_ids??????
45
46 // return std::format("<text_style id={},v={},s={},c={},d={}>",
47 // rhs.family_id, rhs.variant, rhs.size, rhs.color, rhs.decoration
48 //);
49 hi_not_implemented();
50 }
51
52 friend std::ostream &operator<<(std::ostream &lhs, text_style const &rhs)
53 {
54 return lhs << to_string(rhs);
55 }
56};
57
58} // namespace hi::inline v1
This is a RGBA floating point color.
Definition color.hpp:37
A font variant is one of 16 different fonts that can be part of a family.
Definition font_variant.hpp:16
Definition text_style.hpp:18