7#include "otype_utilities.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
13hi_export_module(hikogui.font.otype_sfnt);
15hi_export
namespace hi {
18template<fixed_
string Name>
19[[nodiscard]]
inline std::span<std::byte const> otype_sfnt_search(std::span<std::byte const> bytes)
22 big_uint32_buf_t scaler_type;
23 big_uint16_buf_t num_tables;
24 big_uint16_buf_t search_range;
25 big_uint16_buf_t entry_selector;
26 big_uint16_buf_t range_shift;
31 big_uint32_buf_t check_sum;
32 big_uint32_buf_t offset;
33 big_uint32_buf_t length;
37 auto const& header = implicit_cast<header_type>(offset, bytes);
39 if (not (*header.scaler_type ==
"true"_fcc or *header.scaler_type == 0x00010000)) {
40 throw parse_error(
"sfnt.scalerType is not 'true' or 0x00010000");
43 auto const entries = implicit_cast<entry_type>(offset, bytes, *header.num_tables);
45 if (
auto const entry = fast_binary_search_eq<std::endian::big>(entries, fourcc<Name>())) {
46 return hi_check_subspan(bytes, *entry->offset, *entry->length);
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20