Skip to content

Commit

Permalink
ci: use Haixing-Hu/latex-chinese-fonts for fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok1 committed Feb 26, 2025
1 parent 7e41b67 commit 32300f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ jobs:
PYTHONUTF8: 1
steps:
- uses: actions/checkout@v4
- name: Checkout Haixing-Hu/latex-chinese-fonts
uses: actions/checkout@v4
with:
repository: Haixing-Hu/latex-chinese-fonts
path: fonts
- uses: typst-community/setup-typst@v4

- name: Install Chinese (Simplified) Supplemental Fonts
shell: pwsh
run: Add-WindowsCapability -Online -Name "Language.Fonts.Hans~~~und-HANS~0.0.1.0"
- name: Install Chinese (Traditional) Supplemental Fonts
shell: pwsh
run: Add-WindowsCapability -Online -Name "Language.Fonts.Hant~~~und-HANT~0.0.1.0"
- run: typst fonts

- run: typst fonts --font-path fonts
- run: python3 ci/mode_switch.py dev templates
- run: python3 ci/build.py
- uses: actions/upload-artifact@v4
Expand Down
11 changes: 10 additions & 1 deletion ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
input_file = f"templates/{basename}.typ"
output_file = f"build/{basename}.pdf"

command = ["typst", "compile", input_file, output_file, "--root", "."]
command = [
"typst",
"compile",
input_file,
output_file,
"--root",
".",
"--font-path",
"fonts",
]
print(f"[build.py] Running command: {' '.join(command)}")
res = subprocess.run(command)
if res.returncode != 0:
Expand Down
2 changes: 1 addition & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ file_basenames=($(basename -s .typ templates/*.typ))
mkdir -p build/

for basename in "${file_basenames[@]}"; do
typst compile "templates/${basename}.typ" "build/${basename}.pdf" --root .
typst compile "templates/${basename}.typ" "build/${basename}.pdf" --root . --font-path fonts
done

0 comments on commit 32300f1

Please sign in to comment.