mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
wasm: show color atlas in example web app
This commit is contained in:
@ -42,6 +42,7 @@ fetch(url.href).then(response =>
|
||||
group_cache_index_for_codepoint,
|
||||
group_cache_render_glyph,
|
||||
group_cache_atlas_greyscale,
|
||||
group_cache_atlas_color,
|
||||
atlas_new,
|
||||
atlas_free,
|
||||
atlas_debug_canvas,
|
||||
@ -90,9 +91,17 @@ 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));
|
||||
}
|
||||
|
||||
{
|
||||
const atlas = group_cache_atlas_color(group_cache);
|
||||
const id = atlas_debug_canvas(atlas);
|
||||
document.getElementById("atlas-color-canvas").append(zjs.deleteValue(id));
|
||||
}
|
||||
|
||||
//face_free(face);
|
||||
});
|
||||
|
@ -7,9 +7,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<p>Open your console, we are just debugging here.</p>
|
||||
<p>The font rendering canvas should show below. This shows a single glyph.</p>
|
||||
<div><div id="face-canvas" style="display: inline-block; border: 1px solid red;"></div></div>
|
||||
<p>The current font atlas is rendered below.</p>
|
||||
<p>The current <b>greyscale</b> font atlas is rendered below.</p>
|
||||
<div><div id="atlas-canvas" style="display: inline-block; border: 1px solid green;"></div></div>
|
||||
<p>The current <b>color</b> font atlas is rendered below.</p>
|
||||
<div><div id="atlas-color-canvas" style="display: inline-block; border: 1px solid blue;"></div></div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -311,6 +311,10 @@ pub const Wasm = struct {
|
||||
export fn group_cache_atlas_greyscale(self: *GroupCache) *font.Atlas {
|
||||
return &self.atlas_greyscale;
|
||||
}
|
||||
|
||||
export fn group_cache_atlas_color(self: *GroupCache) *font.Atlas {
|
||||
return &self.atlas_color;
|
||||
}
|
||||
};
|
||||
|
||||
test "resize" {
|
||||
|
Reference in New Issue
Block a user