mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-22 23:35:20 +00:00
font: GroupCache is wasm compatible
This commit is contained in:
@@ -37,6 +37,11 @@ fetch(url.href).then(response =>
|
||||
group_add_face,
|
||||
group_index_for_codepoint,
|
||||
group_render_glyph,
|
||||
group_cache_new,
|
||||
group_cache_free,
|
||||
group_cache_index_for_codepoint,
|
||||
group_cache_render_glyph,
|
||||
group_cache_atlas_greyscale,
|
||||
atlas_new,
|
||||
atlas_free,
|
||||
atlas_debug_canvas,
|
||||
@@ -49,7 +54,7 @@ fetch(url.href).then(response =>
|
||||
zjs.memory = memory;
|
||||
|
||||
// Create our atlas
|
||||
const atlas = atlas_new(512, 0 /* greyscale */);
|
||||
// const atlas = atlas_new(512, 0 /* greyscale */);
|
||||
|
||||
// Create some memory for our string
|
||||
const font = new TextEncoder().encode("monospace");
|
||||
@@ -69,10 +74,13 @@ fetch(url.href).then(response =>
|
||||
const group = group_new(72 /* size */);
|
||||
group_add_face(group, 0, df);
|
||||
|
||||
// Create our group cache
|
||||
const group_cache = group_cache_new(group);
|
||||
|
||||
// Render a glyph
|
||||
for (let i = 33; i <= 126; i++) {
|
||||
const font_idx = group_index_for_codepoint(group, i, 0, -1);
|
||||
group_render_glyph(group, atlas, font_idx, i, 0);
|
||||
const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1);
|
||||
group_cache_render_glyph(group_cache, font_idx, i, 0);
|
||||
//face_render_glyph(face, atlas, i);
|
||||
}
|
||||
//face_render_glyph(face, atlas, "橋".codePointAt(0));
|
||||
@@ -82,6 +90,7 @@ fetch(url.href).then(response =>
|
||||
//face_debug_canvas(face);
|
||||
|
||||
// Debug our atlas canvas
|
||||
const atlas = group_cache_atlas_greyscale(group_cache);
|
||||
const id = atlas_debug_canvas(atlas);
|
||||
document.getElementById("atlas-canvas").append(zjs.deleteValue(id));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user