#include <cstddef>#include <cstdint>#include <memory>#include <optional>#include <span>#include <string_view>#include "donner/base/fonts/CffOutlineComplexity.h"Classes | |
| struct | donner::fonts::SfntValidationOptions |
| Caller-selected limits for one sfnt validation. More... | |
| struct | donner::fonts::SfntValidationMetrics |
| Work and limiting outcome observed while validating one sfnt. More... | |
| class | donner::fonts::SfntFont |
| Validated, allocation-bounded index for one sfnt font. More... | |
| struct | donner::fonts::SfntFont::TableRecord |
| A table location validated against the original font byte span. More... | |
| struct | donner::fonts::SfntFont::GlyphOutlineComplexity |
| Allocation and CPU-work ceiling proved for one glyph outline. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Functions | |
| uint16_t | donner::fonts::ReadBe16 (const uint8_t *p) |
Read a 16-bit big-endian unsigned integer from p. | |
| uint32_t | donner::fonts::ReadBe32 (const uint8_t *p) |
Read a 32-bit big-endian unsigned integer from p. | |
| uint32_t | donner::fonts::SfntTag (std::string_view tag) |
| Convert a four-byte sfnt tag to its big-endian integer representation. | |
| uint32_t | donner::fonts::SfntTableChecksum (std::span< const uint8_t > data, uint32_t initial=0) |
| Compute an sfnt table-directory checksum: the sum, modulo 2^32, of the table's big-endian 32-bit words, with a final partial word padded with zero bytes. | |
| bool | donner::fonts::ValidateSfnt (std::span< const uint8_t > data) |
Return true when data passes the bounded sfnt and outline validation policy. | |
| std::optional< std::span< const uint8_t > > | donner::fonts::FindSfntTable (std::span< const uint8_t > data, std::string_view tag) |
| Return a bounded sfnt table by its four-byte tag. | |
| struct donner::fonts::SfntFont::TableRecord |
| struct donner::fonts::SfntFont::GlyphOutlineComplexity |
| std::optional< std::span< const uint8_t > > donner::fonts::FindSfntTable | ( | std::span< const uint8_t > | data, |
| std::string_view | tag ) |
Return a bounded sfnt table by its four-byte tag.
This compatibility helper performs a fresh, explicitly bounded validation. Repeated callers should retain a donner::fonts::SfntFont and call donner::fonts::SfntFont::findTable instead.
| uint32_t donner::fonts::SfntTableChecksum | ( | std::span< const uint8_t > | data, |
| uint32_t | initial = 0 ) |
Compute an sfnt table-directory checksum: the sum, modulo 2^32, of the table's big-endian 32-bit words, with a final partial word padded with zero bytes.
Checksums of consecutive chunks add up, so a long table can be summed in pieces by passing each piece's result as the next piece's initial; every piece but the last must be a multiple of four bytes long.
| data | Table bytes, or the next chunk of them. |
| initial | Sum of the preceding chunks of the same table. |