docs: unify algorithm explanation and update teaching video

This commit is contained in:
Yaossg 2026-10-16 17:50:08 +08:00
parent a1e43bb679
commit dd5fab9540
15 changed files with 1680 additions and 1050 deletions

View file

@ -2,6 +2,7 @@
from pathlib import Path
import os
import shutil
import shlex
import subprocess
HERE = Path(__file__).resolve().parent
@ -23,7 +24,9 @@ def prepare_tex(env):
'TEXMFCNF': str(dist/'web2c'),
'TEXMFROOT': str(root/'usr/share/texlive'),
'TEXMFDIST': str(dist),
'TEXMF': '{'+str(dist)+','+str(root/'usr/share/texmf')+'}',
# Database-only lookup avoids recursive misses on the WSL filesystem.
'TEXMF': '{!!'+str(dist)+',!!'+str(root/'usr/share/texmf')+'}',
'TEXMFDBS': '{'+str(dist)+','+str(root/'usr/share/texmf')+'}',
'TEXMFVAR': str(root/'var'),
'TEXMFCONFIG': str(root/'config'),
'TEXMFHOME': str(root/'texmf-home'),
@ -40,4 +43,14 @@ def prepare_tex(env):
subprocess.run(['pdftex', '-ini', '-etex', '-interaction=nonstopmode', '-halt-on-error',
'-jobname=latex', '-progname=latex', 'latex.ini'],
cwd=formats, env=env, check=True)
# These scenes use TeX glyphs and dvisvgm raw SVG groups, without PS artwork.
# The unpacked Ghostscript cannot initialize its device in this environment;
# skip only PS specials while preserving raw SVG and vector glyph outlines.
wrappers = root / 'tools'
wrappers.mkdir(exist_ok=True)
converter = wrappers / 'dvisvgm'
converter.write_text('#!/bin/sh\nexec '+shlex.quote(str(root/'usr/bin/dvisvgm'))+
' --no-specials=ps "$@"\n')
converter.chmod(0o755)
env['PATH'] = str(wrappers)+os.pathsep+env['PATH']
return env