mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
update example to show multi-codepoint grapheme
This commit is contained in:
@ -98,7 +98,7 @@ fetch(url.href).then(response =>
|
||||
const emoji = ["🐏","🌞","🌚","🍱","💿","🐈","📃","📀","🕡","🙃"];
|
||||
for (let i = 0; i < emoji.length; i++) {
|
||||
const cp = emoji[i].codePointAt(0);
|
||||
const font_idx = group_cache_index_for_codepoint(group_cache, cp, 0, 1 /* emoji */);
|
||||
const font_idx = group_cache_index_for_codepoint(group_cache, cp, 0, -1 /* best choice */);
|
||||
group_cache_render_glyph(group_cache, font_idx, cp, 0);
|
||||
}
|
||||
|
||||
@ -108,6 +108,16 @@ fetch(url.href).then(response =>
|
||||
// Debug our canvas
|
||||
//face_debug_canvas(face);
|
||||
|
||||
// Let's try shaping
|
||||
const shaper = shaper_new(120);
|
||||
//const input = makeStr("hello🐏");
|
||||
const input = makeStr("hello🐏👍🏽");
|
||||
shaper_test(shaper, group_cache, input.ptr, input.len);
|
||||
|
||||
const cp = 1114112;
|
||||
const font_idx = group_cache_index_for_codepoint(group_cache, cp, 0, -1 /* best choice */);
|
||||
group_cache_render_glyph(group_cache, font_idx, cp, -1);
|
||||
|
||||
// Debug our atlas canvas
|
||||
{
|
||||
const atlas = group_cache_atlas_greyscale(group_cache);
|
||||
@ -121,10 +131,5 @@ fetch(url.href).then(response =>
|
||||
document.getElementById("atlas-color-canvas").append(zjs.deleteValue(id));
|
||||
}
|
||||
|
||||
// Let's try shaping
|
||||
const shaper = shaper_new(120);
|
||||
const input = makeStr("hello");
|
||||
shaper_test(shaper, group_cache, input.ptr, input.len);
|
||||
|
||||
//face_free(face);
|
||||
});
|
||||
|
Reference in New Issue
Block a user