library: vendors/kb_text_shape + vendors/file_utils; modules/ffi/stb_truetype.sx retired

kb_text_shape (v2.10, JimmyLefevre) had been LOST from the sx tree —
ffi/stb_truetype.sx referenced repo paths that no longer existed (and
nothing runs glyph_cache, so the dangling unit never fired). The
trimmed copy returns from the m3te project as a proper vendor:
curated c/kbts_api.h decls over the full upstream header, README with
provenance, and examples/1627 pinning context + font creation so the
unit compiles and runs in-suite. file_utils (in-house asset-read
helper with the Android AAssetManager hook) gets the same unit shape.

modules/ffi/stb_truetype.sx is gone: glyph_cache imports the three
vendored units (stb_truetype, kb_text_shape, file_utils) directly.
This commit is contained in:
agra
2026-06-12 17:58:23 +03:00
parent 58af806b7a
commit b06776d6e9
15 changed files with 30919 additions and 14 deletions

View File

@@ -0,0 +1,28 @@
// The sx library ships kb_text_shape: `#import "vendors/kb_text_shape/
// kb_text_shape.sx"` resolves through the stdlib search paths and the
// ~30k-line implementation compiles through the object cache (decls
// come from the curated c/kbts_api.h). Pins INVARIANTS only: a shape
// context constructs, the system Helvetica loads as a shaping font,
// and teardown is clean.
#import "modules/std.sx";
fs :: #import "modules/std/fs.sx";
kb :: #import "vendors/kb_text_shape/kb_text_shape.sx";
main :: () -> i32 {
data := fs.read_file("/System/Library/Fonts/Helvetica.ttc");
if data == null {
print("font missing\n");
return 1;
}
bytes := data!;
ctx := kb.kbts_CreateShapeContext(xx 0, xx 0);
print("context created: {}\n", xx ctx != 0);
font := kb.kbts_ShapePushFontFromMemory(ctx, xx bytes.ptr, xx bytes.len, 0);
print("font pushed: {}\n", xx font != 0);
kb.kbts_DestroyShapeContext(ctx);
print("context destroyed\n");
0
}

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
context created: true
font pushed: true
context destroyed