HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
text_stencil.hpp
1// Copyright Take Vos 2020.
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 "stencil.hpp"
8#include "../text/shaped_text.hpp"
9#include "../text/text_style.hpp"
10#include <string_view>
11
12namespace tt {
13
14class text_stencil : public stencil {
15public:
16 using super = stencil;
17
18 text_stencil(alignment alignment, std::u8string_view text, text_style style) noexcept;
19 text_stencil(alignment alignment, std::u8string text, text_style style) noexcept;
20
21 [[nodiscard]] f32x4 preferred_extent() noexcept override;
22
23 void draw(draw_context context, bool use_context_color = false) noexcept override;
24
25private:
26 std::u8string _text;
27 text_style _style;
28 shaped_text _shaped_text;
29 matrix2 _shaped_text_transform;
30};
31
32} // namespace tt
STL namespace.
Draw context for drawing using the TTauri shaders.
Definition draw_context.hpp:33
Definition stencil.hpp:15
Definition text_stencil.hpp:14
f32x4 preferred_extent() noexcept override
Return the extent that this cell wants to be drawn as.
void draw(draw_context context, bool use_context_color=false) noexcept override
Draw the cell.
shaped_text represent a piece of text shaped to be displayed.
Definition shaped_text.hpp:22
Definition text_style.hpp:16