font: fix some JS memory leaks
parent
ed4e8c36b0
commit
d2afddb7e2
|
|
@ -55,6 +55,7 @@ fetch(url.href).then(response =>
|
|||
for (let i = 33; i <= 126; i++) {
|
||||
face_render_glyph(face, atlas, i);
|
||||
}
|
||||
//face_render_glyph(face, atlas, "橋".codePointAt(0));
|
||||
//face_render_glyph(face, atlas, "p".codePointAt(0));
|
||||
|
||||
// Debug our canvas
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ pub const Wasm = struct {
|
|||
// This will return the same context on subsequent calls so it
|
||||
// is important to reset it.
|
||||
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.
|
||||
var buf: []u8 = switch (self.format) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,6 @@ pub const Face = struct {
|
|||
});
|
||||
|
||||
// Draw glyph
|
||||
// TODO: may need a +1 on the left/asc here to avoid clipping
|
||||
try ctx.set("fillStyle", js.string("black"));
|
||||
try ctx.call(void, "fillText", .{
|
||||
glyph_str,
|
||||
|
|
|
|||
Loading…
Reference in New Issue