mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
font: fix some JS memory leaks
This commit is contained in:
@ -55,6 +55,7 @@ fetch(url.href).then(response =>
|
|||||||
for (let i = 33; i <= 126; i++) {
|
for (let i = 33; i <= 126; i++) {
|
||||||
face_render_glyph(face, atlas, i);
|
face_render_glyph(face, atlas, i);
|
||||||
}
|
}
|
||||||
|
//face_render_glyph(face, atlas, "橋".codePointAt(0));
|
||||||
//face_render_glyph(face, atlas, "p".codePointAt(0));
|
//face_render_glyph(face, atlas, "p".codePointAt(0));
|
||||||
|
|
||||||
// Debug our canvas
|
// Debug our canvas
|
||||||
|
@ -392,7 +392,7 @@ pub const Wasm = struct {
|
|||||||
// This will return the same context on subsequent calls so it
|
// This will return the same context on subsequent calls so it
|
||||||
// is important to reset it.
|
// is important to reset it.
|
||||||
const ctx = try canvas.call(js.Object, "getContext", .{js.string("2d")});
|
const ctx = try canvas.call(js.Object, "getContext", .{js.string("2d")});
|
||||||
errdefer ctx.deinit();
|
defer ctx.deinit();
|
||||||
|
|
||||||
// We need to draw pixels so this is format dependent.
|
// We need to draw pixels so this is format dependent.
|
||||||
var buf: []u8 = switch (self.format) {
|
var buf: []u8 = switch (self.format) {
|
||||||
|
@ -163,7 +163,6 @@ pub const Face = struct {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Draw glyph
|
// Draw glyph
|
||||||
// TODO: may need a +1 on the left/asc here to avoid clipping
|
|
||||||
try ctx.set("fillStyle", js.string("black"));
|
try ctx.set("fillStyle", js.string("black"));
|
||||||
try ctx.call(void, "fillText", .{
|
try ctx.call(void, "fillText", .{
|
||||||
glyph_str,
|
glyph_str,
|
||||||
|
Reference in New Issue
Block a user