Skip to content

Commit

Permalink
Ensures `build folder exists
Browse files Browse the repository at this point in the history
  • Loading branch information
catusphan committed Nov 14, 2024
1 parent 9a7afc6 commit 4b03ff8
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\index.js",
"args": [
"--max_old_space_size=8192",
"--optimize_for_size",
"--stack_size=4096",
"--require",
"babel-core/register",
"--config=./src/config/catus.bottom.js",
"--data=src/data-small-org.json",
"--font-name=Leo-Pinyin-Bottom",
"--base-font=resources/fonts/NotoSerifSC-Regular.ttf",
"--ruby-font=resources/fonts/LXGWWenKaiMono-Regular.ttf",
]
}
]
}


7 changes: 4 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
8TODO List
- [ ] Remove chars that not in input fonts- [X] Build serif version
- [ ] Change the font names to be without '-'
- [ ] Include the built fonts in 'input' folder
- [ ] Remove chars that not in input fonts
- [X] Build serif version
- [ ] Tạo thêm hình ảnh font sau khi tạo ra
- [ ] Make right option
- [X] Build 4 variants: top/bottom/left/right
- [X] Change font output folder to `output`
- [ ] Change the font names to be without '-'
- [ ] Include the built fonts in 'input' folder
4 changes: 2 additions & 2 deletions build_bottom_full.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rm -f build/svg/*

time node --max_old_space_size=8192 --optimize_for_size --stack_size=4096 --require babel-core/register ./index.js --config=./src/config/bottom.js --data=src/data-org.json --font-name=Leo-Pinyin-Bottom --base-font=resources/fonts/NotoSerifSC-Regular.ttf --ruby-font=resources/fonts/LXGWWenKaiMono-Regular.ttf
time node --max_old_space_size=8192 --optimize_for_size --stack_size=4096 --require babel-core/register ./index.js --config=./src/config/catus.bottom.js --data=src/data-org.json --font-name=Leo-Pinyin-Bottom --base-font=resources/fonts/NotoSerifSC-Regular.ttf --ruby-font=resources/fonts/LXGWWenKaiMono-Regular.ttf

python3 tools/font_stats.py build/Leo-Pinyin-Bottom.ttf --detailed
#python3 tools/font_stats.py build/Leo-Pinyin-Bottom.ttf --detailed
1 change: 1 addition & 0 deletions find_coderanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def get_unicode_ranges_with_names(font_path):
font_path = "resources/fonts/LXGWWenKaiMono-Regular.ttf"
font_path = "resources/fonts/SourceHanSansCN-Regular.ttf"
font_path = "resources/fonts/WqyMono.ttf"
font_path = "output/Pinyin-Test-Bottom-Small.ttf"

get_unicode_ranges_with_names(font_path)

22 changes: 21 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
import webfont from 'webfont'
import jsonfile from 'jsonfile'
import webfont from 'webfont'
import { argv } from 'yargs'






import helpers from './src/helpers'
import ruby from './src/ruby'
import svg from './src/svg'






function generateSvg(data, config) {
const baseEngine = ruby.loadFont(config.baseFontFilepath)
const rubyEngine = ruby.loadFont(config.rubyFontFilepath)
const build_folder = `${config.workingDir}`

const fs = require('fs');

if (!fs.existsSync(build_folder)) {
fs.mkdirSync(build_folder, { recursive: true });
console.log(`Folder created: ${build_folder}`);
} else {
console.log(`Folder already exists: ${build_folder}`);
}

for (let datum = 0; datum < data.length; datum += 1) {
const char = data[datum]
Expand Down
File renamed without changes.

0 comments on commit 4b03ff8

Please sign in to comment.