HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
glyph_atlas_info.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
6#pragma once
7
8#include "../geometry/geometry.hpp"
9#include "../utility/utility.hpp"
10#include "../macros.hpp"
11
12hi_export_module(hikogui.font.glyph_atlas_info);
13
14hi_export namespace hi::inline v1 {
15
16hi_export class glyph_atlas_info {
17public:
24
27 extent2 size;
28
32
38
39 [[nodiscard]] constexpr bool empty() const noexcept
40 {
41 return size == extent2{};
42 }
43
44 [[nodiscard]] constexpr operator bool() const noexcept
45 {
46 return not empty();
47 }
48
49 constexpr glyph_atlas_info() noexcept = default;
50
58 constexpr glyph_atlas_info(point3 position, extent2 size, scale2 border_scale, scale2 texture_coordinate_scale) noexcept :
59 position(position),
60 size(size),
61 border_scale(border_scale),
62 texture_coordinates(bounding_rectangle(texture_coordinate_scale * rectangle{position, size}))
63 {
64 hi_axiom(position == floor(position));
65 hi_axiom(size == ceil(size));
66 }
67};
68
69} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Definition glyph_atlas_info.hpp:16
scale2 border_scale
The scaling factor used for scaling a quad to include the border.
Definition glyph_atlas_info.hpp:31
point3 position
pixel coordinates.
Definition glyph_atlas_info.hpp:23
extent2 size
Size of the glyph in pixels in the texture map.
Definition glyph_atlas_info.hpp:27
aarectangle texture_coordinates
The position and size of the glyph in the texture in UV coordinates.
Definition glyph_atlas_info.hpp:37
A high-level geometric point Part of the high-level vec, point, mat and color types.
Definition point3.hpp:29