capsules/fonts: JetBrainsMono-Regular.ttf as a raw-blob capsule (item 4.3.7b)
mkcapsule.c already ingests arbitrary non-.4th files as raw byte blobs (validate_forth_blocks only applies to .4th filenames), so no hex/base64 text-encoding or tool changes are needed -- corrects the design premise in FABRIC.md's 4.3.7b item text (see the FABRIC.md correction note this commit carries). ttf_load_from_capsule() resolves the font capsule by name, validates its content hash, and points ttf_font_t at the capsule arena bytes directly, zero-copy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
70b6918279
commit
2ef8d26c6f
@@ -182,6 +182,33 @@ typedef struct {
|
||||
*/
|
||||
int ttf_glyph_outline(const ttf_font_t *font, uint32_t glyph_index, ttf_outline_t *out);
|
||||
|
||||
#ifdef __STARKERNEL__
|
||||
#include "capsule.h"
|
||||
|
||||
/**
|
||||
* ttf_load_from_capsule - Resolve a font capsule by name and parse it,
|
||||
* zero-copy (FABRIC.md item 4.3.7b). `out` borrows the capsule payload
|
||||
* directly from `arena` — no kmalloc, no decode step, since the capsule
|
||||
* is already a raw-byte match of the source `.ttf` (see
|
||||
* capsules/fonts/README.md and FABRIC.md §27.7's 2026-08-10 correction:
|
||||
* capsule storage needs no hex/base64 text-encoding, `tools/mkcapsule.c`
|
||||
* already embeds arbitrary files as raw bytes). Validates the capsule's
|
||||
* content hash (`capsule_validate(..., verify_hash=1)`) before parsing.
|
||||
*
|
||||
* @param capsule_name Colon-separated capsule name, e.g.
|
||||
* "fonts:JetBrainsMono-Regular.ttf"
|
||||
* @return TTF_OK, TTF_ERR_TABLE_MISSING if the capsule isn't found, or a
|
||||
* capsule-validation/ttf_parse TTF_ERR_* code
|
||||
*/
|
||||
int ttf_load_from_capsule(
|
||||
const CapsuleDirHeader *dir,
|
||||
const CapsuleDesc *descs,
|
||||
const CapsuleNameEntry *names,
|
||||
const uint8_t *arena,
|
||||
const char *capsule_name,
|
||||
ttf_font_t *out);
|
||||
#endif /* __STARKERNEL__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user