7#include "../utility/module.hpp"
8#include "../placement.hpp"
11namespace hi {
inline namespace v1 {
18 constexpr float operator*()
const noexcept
20 return static_cast<float>(*x) / 65536.0f;
29 constexpr float operator*()
const noexcept
31 return static_cast<float>(*x) / 16384.0f;
39 [[nodiscard]]
constexpr float operator*(
float Em_scale)
const noexcept
41 return static_cast<float>(*x) * Em_scale;
49 [[nodiscard]]
constexpr float operator*(
float Em_scale)
const noexcept
51 return static_cast<float>(x) * Em_scale;
59 [[nodiscard]]
constexpr float operator*(
float Em_scale)
const noexcept
61 return static_cast<float>(*x) * Em_scale;
65inline std::optional<std::string>
66otype_get_string(std::span<std::byte const> bytes, uint16_t platform_id, uint16_t platform_specific_id)
68 switch (platform_id) {
71 hi_check(bytes.size() % 2 == 0,
"Length in bytes of a name must be multiple of two");
72 return char_converter<
"utf-16",
"utf-8">{}.
read(bytes.data(), bytes.size(), std::endian::big);
75 if (platform_specific_id == 0) {
76 return char_converter<
"utf-8",
"utf-8">{}.read(bytes.data(), bytes.size());
81 if (platform_specific_id == 1 or platform_specific_id == 10) {
82 hi_check(bytes.size() % 2 == 0,
"Length in bytes of a name must be multiple of two");
83 return char_converter<
"utf-16",
"utf-8">{}.read(bytes.data(), bytes.size(), std::endian::big);
#define hi_check(expression, message,...)
Check if the expression is valid, or throw a parse_error.
Definition assert.hpp:110
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
A converter between character encodings.
Definition char_converter.hpp:92
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:180
Open-type 16.16 signed fixed point, range between -32768.0 and 32767.999.
Definition otype_utilities.hpp:15
Open-type 16-bit signed fraction, range between -2.0 and 1.999.
Definition otype_utilities.hpp:26
Open-type for 16 signed integer that must be scaled by the EM-scale.
Definition otype_utilities.hpp:37
Open-type for 8 signed integer that must be scaled by the EM-scale.
Definition otype_utilities.hpp:47
Open-type for 16 unsigned integer that must be scaled by the EM-scale.
Definition otype_utilities.hpp:57