summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-12-05 20:52:03 -0800
committerMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-12-05 20:52:03 -0800
commit62990bb33e8c87938f3795a8f4123c59dd53b047 (patch)
treeaf5efe469c17fb379b3b1e2a64252c63f00287d8 /example
parentaaa0d46b5d221408d1a36ca796243ab9c28ba8ca (diff)
font: Group is now wasm-compatible
Diffstat (limited to 'example')
-rw-r--r--example/app.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/example/app.ts b/example/app.ts
index 5dcd949be..85eee4d5b 100644
--- a/example/app.ts
+++ b/example/app.ts
@@ -32,6 +32,11 @@ fetch(url.href).then(response =>
deferred_face_free,
deferred_face_load,
deferred_face_face,
+ group_new,
+ group_free,
+ group_add_face,
+ group_index_for_codepoint,
+ group_render_glyph,
atlas_new,
atlas_free,
atlas_debug_canvas,
@@ -53,22 +58,28 @@ fetch(url.href).then(response =>
// Initialize our deferred face
const df = deferred_face_new(font_ptr, font.byteLength);
- deferred_face_load(df, 72 /* size */);
- const face = deferred_face_face(df);
+ //deferred_face_load(df, 72 /* size */);
+ //const face = deferred_face_face(df);
// Initialize our font face
//const face = face_new(font_ptr, font.byteLength, 72 /* size in px */);
free(font_ptr);
+ // Create our group
+ const group = group_new(72 /* size */);
+ group_add_face(group, 0, df);
+
// Render a glyph
for (let i = 33; i <= 126; i++) {
- face_render_glyph(face, atlas, i);
+ const font_idx = group_index_for_codepoint(group, i, 0, -1);
+ group_render_glyph(group, atlas, font_idx, i, 0);
+ //face_render_glyph(face, atlas, i);
}
//face_render_glyph(face, atlas, "橋".codePointAt(0));
//face_render_glyph(face, atlas, "p".codePointAt(0));
// Debug our canvas
- face_debug_canvas(face);
+ //face_debug_canvas(face);
// Debug our atlas canvas
const id = atlas_debug_canvas(atlas);