Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webfont -> svgtofont #597

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ postpackage.mjs
updatefonts.mjs
genaiscript.cjs
esbuild.*
genaiscript.manifest
font/*
built/*.woff2
built/*.ttf
built/*.extension
built/*.symbol.svg
genaiscript.manifest
10 changes: 10 additions & 0 deletions packages/vscode/font/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@
"eslint": "^9.8.0",
"markdown-it-github-alerts": "^0.3.0",
"process": "^0.11.10",
"svgtofont": "^5.0.2",
"typescript": "5.5.4",
"vscode-uri": "^3.0.8",
"webfont": "^11.2.26",
"websocket-polyfill": "0.0.3",
"zx": "^8.1.4"
},
Expand Down
26 changes: 12 additions & 14 deletions packages/vscode/updatefonts.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import "zx/globals"
import webfont from "webfont"

const svgs = ["./icon.svg"]
import svgtofont from "svgtofont"

async function generateFont() {
try {
console.log(`build font for ${svgs}`)
const result = await webfont.webfont({
files: svgs,
formats: ["woff"],
console.log(`build font`)
await svgtofont({
src: path.resolve("./font"),
dist: path.resolve("./built"),
fontName: "genaiscript",
startUnicode: 0xe000,
verbose: false,
normalize: true,
sort: false,
css: false,
website: null,
svgicons2svgfont: {
fontHeight: 1000,
normalize: true,
},
})
fs.ensureDirSync("./built")
const dest = path.join("./built", "genaiscript.woff")
fs.writeFileSync(dest, result.woff, "binary")
console.log(`Font created at ${dest}`)
process.exit(0)
} catch (e) {
console.error("Font creation failed.", e)
Expand Down
Loading
Loading