7#include "../utility/utility.hpp"
8#include "../parser/parser.hpp"
9#include "../macros.hpp"
12hi_export_module(hikogui.font.otype_utilities);
14hi_export
namespace hi {
inline namespace v1 {
21 constexpr float operator*()
const noexcept
23 return static_cast<float>(*x) / 65536.0f;
32 constexpr float operator*()
const noexcept
34 return static_cast<float>(*x) / 16384.0f;
42 [[nodiscard]]
constexpr float operator*(
float Em_scale)
const noexcept
44 return static_cast<float>(*x) * Em_scale;
52 [[nodiscard]]
constexpr float operator*(
float Em_scale)
const noexcept
54 return static_cast<float>(x) * Em_scale;
62 [[nodiscard]]
constexpr float operator*(
float Em_scale)
const noexcept
64 return static_cast<float>(*x) * Em_scale;
68inline std::optional<std::string>
69otype_get_string(std::span<std::byte const> bytes, uint16_t platform_id, uint16_t platform_specific_id)
71 switch (platform_id) {
74 hi_check(bytes.size() % 2 == 0,
"Length in bytes of a name must be multiple of two");
75 return char_converter<
"utf-16",
"utf-8">{}.
read(bytes.data(), bytes.size(), std::endian::big);
78 if (platform_specific_id == 0) {
79 return char_converter<
"utf-8",
"utf-8">{}.read(bytes.data(), bytes.size());
84 if (platform_specific_id == 1 or platform_specific_id == 10) {
85 hi_check(bytes.size() % 2 == 0,
"Length in bytes of a name must be multiple of two");
86 return char_converter<
"utf-16",
"utf-8">{}.read(bytes.data(), bytes.size(), std::endian::big);
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
A converter between character encodings.
Definition char_converter.hpp:98
OutRange read(void const *ptr, size_t size, std::endian endian=std::endian::native) noexcept
Read text from a byte array.
Definition char_converter.hpp:186
Open-type 16.16 signed fixed point, range between -32768.0 and 32767.999.
Definition otype_utilities.hpp:18
Open-type 16-bit signed fraction, range between -2.0 and 1.999.
Definition otype_utilities.hpp:29
Open-type for 16 signed integer that must be scaled by the EM-scale.
Definition otype_utilities.hpp:40
Open-type for 8 signed integer that must be scaled by the EM-scale.
Definition otype_utilities.hpp:50
Open-type for 16 unsigned integer that must be scaled by the EM-scale.
Definition otype_utilities.hpp:60