HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
glyph_metrics.hpp
1// Copyright Take Vos 2019, 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 "../utility/utility.hpp"
8#include "../geometry/geometry.hpp"
9#include "../macros.hpp"
10#include <compare>
11
12hi_export_module(hikogui.font.glyph_metrics);
13
14hi_export namespace hi::inline v1 {
15
20hi_export struct glyph_metrics {
23 aarectangle bounding_rectangle = {};
24
31 float left_side_bearing = 0.0f;
32
37 float right_side_bearing = 0.0f;
38
41 float advance = 0.0f;
42
43 glyph_metrics() noexcept = default;
44 glyph_metrics(glyph_metrics const &) noexcept = default;
45 glyph_metrics(glyph_metrics &&) noexcept = default;
46 glyph_metrics &operator=(glyph_metrics const &) noexcept = default;
47 glyph_metrics &operator=(glyph_metrics &&) noexcept = default;
48
51 [[nodiscard]] constexpr friend glyph_metrics operator*(float const &lhs, glyph_metrics const &rhs) noexcept
52 {
54 r.bounding_rectangle = scale2(lhs) * rhs.bounding_rectangle;
55 r.left_side_bearing = lhs * rhs.left_side_bearing;
56 r.right_side_bearing = lhs * rhs.right_side_bearing;
57 r.advance = lhs * rhs.advance;
58 return r;
59 }
60};
61
62} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Definition glyph_metrics.hpp:20
aarectangle bounding_rectangle
Definition glyph_metrics.hpp:23
float right_side_bearing
Definition glyph_metrics.hpp:37
float advance
Definition glyph_metrics.hpp:41
float left_side_bearing
Definition glyph_metrics.hpp:31