lint JSON and Typescript as well

This commit is contained in:
Patrick Fong
2023-09-28 11:05:54 -07:00
parent 1cb6b50331
commit c2ec3f75ad
5 changed files with 219 additions and 203 deletions

View File

@ -1,14 +1,18 @@
import { ZigJS } from 'zig-js';
import { ZigJS } from "zig-js";
const zjs = new ZigJS();
const importObject = {
module: {},
env: {
memory: new WebAssembly.Memory({ initial: 25, maximum: 65536, shared: true }),
memory: new WebAssembly.Memory({
initial: 25,
maximum: 65536,
shared: true,
}),
log: (ptr: number, len: number) => {
const arr = new Uint8ClampedArray(zjs.memory.buffer, ptr, len);
const data = arr.slice();
const str = new TextDecoder('utf-8').decode(data);
const str = new TextDecoder("utf-8").decode(data);
console.log(str);
},
},
@ -16,12 +20,11 @@ const importObject = {
...zjs.importObject(),
};
const url = new URL('ghostty-wasm.wasm', import.meta.url);
fetch(url.href).then(response =>
response.arrayBuffer()
).then(bytes =>
WebAssembly.instantiate(bytes, importObject)
).then(results => {
const url = new URL("ghostty-wasm.wasm", import.meta.url);
fetch(url.href)
.then((response) => response.arrayBuffer())
.then((bytes) => WebAssembly.instantiate(bytes, importObject))
.then((results) => {
const memory = importObject.env.memory;
const {
malloc,
@ -96,8 +99,16 @@ fetch(url.href).then(response =>
// Create our group
const group = group_new(32 /* size */);
group_add_face(group, 0 /* regular */, deferred_face_new(font_name.ptr, font_name.len, 0 /* text */));
group_add_face(group, 0 /* regular */, deferred_face_new(font_name.ptr, font_name.len, 1 /* emoji */));
group_add_face(
group,
0 /* regular */,
deferred_face_new(font_name.ptr, font_name.len, 0 /* text */),
);
group_add_face(
group,
0 /* regular */,
deferred_face_new(font_name.ptr, font_name.len, 1 /* emoji */),
);
// Initialize our sprite font, without this we just use the browser.
group_init_sprite_face(group);
@ -119,7 +130,7 @@ fetch(url.href).then(response =>
// group_cache_render_glyph(group_cache, font_idx, cp, 0);
// }
for (let i = 0x2500; i <= 0x257F; i++) {
for (let i = 0x2500; i <= 0x257f; i++) {
const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1);
group_cache_render_glyph(group_cache, font_idx, i, 0);
}
@ -127,15 +138,15 @@ fetch(url.href).then(response =>
const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1);
group_cache_render_glyph(group_cache, font_idx, i, 0);
}
for (let i = 0x2800; i <= 0x28FF; i++) {
for (let i = 0x2800; i <= 0x28ff; i++) {
const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1);
group_cache_render_glyph(group_cache, font_idx, i, 0);
}
for (let i = 0x1FB00; i <= 0x1FB3B; i++) {
for (let i = 0x1fb00; i <= 0x1fb3b; i++) {
const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1);
group_cache_render_glyph(group_cache, font_idx, i, 0);
}
for (let i = 0x1FB3C; i <= 0x1FB6B; i++) {
for (let i = 0x1fb3c; i <= 0x1fb6b; i++) {
const font_idx = group_cache_index_for_codepoint(group_cache, i, 0, -1);
group_cache_render_glyph(group_cache, font_idx, i, 0);
}
@ -153,7 +164,12 @@ fetch(url.href).then(response =>
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 */);
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
@ -170,4 +186,4 @@ fetch(url.href).then(response =>
}
//face_free(face);
});
});

View File

@ -1,11 +1,11 @@
{
"colors" : [
"colors": [
{
"idiom" : "universal"
"idiom": "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}

View File

@ -1,68 +1,68 @@
{
"images" : [
"images": [
{
"filename" : "Ghostty_256x256x32 6.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
"filename": "Ghostty_256x256x32 6.png",
"idiom": "mac",
"scale": "1x",
"size": "16x16"
},
{
"filename" : "Ghostty_256x256x32 5.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
"filename": "Ghostty_256x256x32 5.png",
"idiom": "mac",
"scale": "2x",
"size": "16x16"
},
{
"filename" : "Ghostty_256x256x32 4.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
"filename": "Ghostty_256x256x32 4.png",
"idiom": "mac",
"scale": "1x",
"size": "32x32"
},
{
"filename" : "Ghostty_256x256x32 3.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
"filename": "Ghostty_256x256x32 3.png",
"idiom": "mac",
"scale": "2x",
"size": "32x32"
},
{
"filename" : "Ghostty_256x256x32 2.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
"filename": "Ghostty_256x256x32 2.png",
"idiom": "mac",
"scale": "1x",
"size": "128x128"
},
{
"filename" : "Ghostty_256x256x32 1.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
"filename": "Ghostty_256x256x32 1.png",
"idiom": "mac",
"scale": "2x",
"size": "128x128"
},
{
"filename" : "Ghostty_256x256x32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
"filename": "Ghostty_256x256x32.png",
"idiom": "mac",
"scale": "1x",
"size": "256x256"
},
{
"filename" : "Ghostty_512x512x32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
"filename": "Ghostty_512x512x32.png",
"idiom": "mac",
"scale": "2x",
"size": "256x256"
},
{
"filename" : "Ghostty_512x512x32 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
"filename": "Ghostty_512x512x32 1.png",
"idiom": "mac",
"scale": "1x",
"size": "512x512"
},
{
"filename" : "Ghostty_512x512x32 2.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
"filename": "Ghostty_512x512x32 2.png",
"idiom": "mac",
"scale": "2x",
"size": "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}

View File

@ -1,23 +1,23 @@
{
"images" : [
"images": [
{
"filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9.png",
"idiom" : "universal",
"scale" : "1x"
"filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9 1.png",
"idiom" : "universal",
"scale" : "2x"
"filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9 1.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename" : "199110421-9ff5fc30-a244-441e-9882-26070662adf9 2.png",
"idiom" : "universal",
"scale" : "3x"
"filename": "199110421-9ff5fc30-a244-441e-9882-26070662adf9 2.png",
"idiom": "universal",
"scale": "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}

View File

@ -1,6 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}