8#include "../graphic_path.hpp"
9#include "../resource_view.hpp"
11#include "../counters.hpp"
20 std::optional<URL> url;
28 uint16_t OS2_xHeight = 0;
29 uint16_t OS2_HHeight = 0;
33 bool locaTableIsOffset32;
38 uint16_t numberOfHMetrics;
45 parse_font_directory();
50 ++global_counter<
"ttf:map">;
52 parse_font_directory();
56 ++global_counter<
"ttf:unmap">;
59 throw parse_error(
"{}: Could not parse font directory.\n{}", to_string(url), e.
what());
70 [[nodiscard]]
bool loaded() const noexcept
override
72 return static_cast<bool>(view);
98 const noexcept override;
105 [[nodiscard]] std::span<std::byte const> getTableBytes(
char const *table_name)
const;
112 void parse_font_directory();
118 void parseHeadTable(std::span<std::byte const> headTableBytes);
120 void parseHheaTable(std::span<std::byte const> bytes);
122 void parseNameTable(std::span<std::byte const> bytes);
124 void parseOS2Table(std::span<std::byte const> bytes);
134 void parseMaxpTable(std::span<std::byte const> bytes);
144 bool update_glyph_metrics(
150 bool loadSimpleGlyph(std::span<std::byte const> bytes, graphic_path &glyph)
const noexcept;
160 bool loadCompoundGlyph(std::span<std::byte const> bytes, graphic_path &glyph,
tt::glyph_id &metrics_glyph_id)
const noexcept;
169 bool loadCompoundglyph_metrics(std::span<std::byte const> bytes,
tt::glyph_id &metrics_glyph_id)
const noexcept;
Exception thrown during parsing on an error.
Definition exception.hpp:26
A path is a vector graphics object.
Definition graphic_path.hpp:28
Definition tagged_id.hpp:18
Definition glyph_metrics.hpp:17
Definition true_type_font.hpp:16
tt::glyph_id find_glyph(char32_t c) const noexcept override
Get the glyph for a code-point.
std::optional< tt::glyph_id > load_glyph(tt::glyph_id glyph_id, graphic_path &path) const noexcept override
Load a glyph into a path.
bool load_glyph_metrics(tt::glyph_id glyph_id, glyph_metrics &metrics, tt::glyph_id lookahead_glyph_id=tt::glyph_id{}) const noexcept override
Load a glyphMetrics into a path.
bool loaded() const noexcept override
Return if the font is loaded.
Definition true_type_font.hpp:70
A mask of unicode code-points.
Definition unicode_mask.hpp:101