7#include "otype_utilities.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
13hi_export_module(hikogui.font.otype_loca);
15hi_export
namespace hi {
inline namespace v1 {
17[[nodiscard]]
inline std::pair<size_t, size_t> otype_loca16_get(std::span<std::byte const> bytes, hi::glyph_id
glyph_id)
19 auto const entries = implicit_cast<big_uint16_buf_t>(bytes, bytes.size() /
sizeof(big_uint16_buf_t));
22 hi_check(first <= last,
"'loca' table has invalid entries.");
26[[nodiscard]]
inline std::pair<size_t, size_t> otype_loca32_get(std::span<std::byte const> bytes, hi::glyph_id
glyph_id)
28 auto const entries = implicit_cast<big_uint32_buf_t>(bytes, bytes.size() /
sizeof(big_uint32_buf_t));
31 hi_check(first <= last,
"'loca' table has invalid entries.");
35[[nodiscard]]
inline std::pair<size_t, size_t>
36otype_loca_get(std::span<std::byte const> loca_bytes, hi::glyph_id
glyph_id,
bool loca_is_offset32)
38 if (loca_is_offset32) {
39 return otype_loca32_get(loca_bytes,
glyph_id);
41 return otype_loca16_get(loca_bytes,
glyph_id);
45[[nodiscard]]
inline std::span<std::byte const> otype_loca_get(
46 std::span<std::byte const> loca_bytes,
47 std::span<std::byte const> glyf_bytes,
49 bool loca_is_offset32)
51 auto const[first, last] = otype_loca_get(loca_bytes,
glyph_id, loca_is_offset32);
52 auto const size = last - first;
53 return hi_check_subspan(glyf_bytes, first, size);
The HikoGUI namespace.
Definition array_generic.hpp:21
The HikoGUI API version 1.
Definition array_generic.hpp:22
constexpr Out wide_cast(In const &rhs) noexcept
Cast to a type which can hold all values from the input type.
Definition cast.hpp:176
The identifier of a glyph in a font-file.
Definition glyph_id.hpp:22