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 "../required.hpp"
8#include "../geometry/axis_aligned_rectangle.hpp"
9#include "../geometry/scale.hpp"
10
11namespace hi::inline v1 {
12
20 aarectangle bounding_rectangle = {};
21
28 float left_side_bearing = 0.0f;
29
34 float right_side_bearing = 0.0f;
35
38 vector2 advance = {0.0f, 0.0f};
39
40 glyph_metrics() noexcept = default;
41 glyph_metrics(glyph_metrics const &) noexcept = default;
42 glyph_metrics(glyph_metrics &&) noexcept = default;
43 glyph_metrics &operator=(glyph_metrics const &) noexcept = default;
44 glyph_metrics &operator=(glyph_metrics &&) noexcept = default;
45
48 [[nodiscard]] constexpr friend glyph_metrics operator*(float const &lhs, glyph_metrics const &rhs) noexcept
49 {
51 r.bounding_rectangle = scale2(lhs) * rhs.bounding_rectangle;
52 r.left_side_bearing = lhs * rhs.left_side_bearing;
53 r.right_side_bearing = lhs * rhs.right_side_bearing;
54 r.advance = lhs * rhs.advance;
55 return r;
56 }
57};
58
59} // namespace hi::inline v1
This file includes required definitions.
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
Definition glyph_metrics.hpp:17
aarectangle bounding_rectangle
Definition glyph_metrics.hpp:20
float right_side_bearing
Definition glyph_metrics.hpp:34
float left_side_bearing
Definition glyph_metrics.hpp:28
vector2 advance
Definition glyph_metrics.hpp:38