Repository navigation
fix(docker): add Type1 fonts for common LaTeX documents to the engine image - #67
Conversation
44d5977 to
82fb082
Compare
nishide-dev
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
must-fix と should-fix はありません。nit がいくつかと、merge 後(v0.1.1 の公開)のための注意を書いておきます。
確認したこと
- PR の head を clone し、engine image を別の tag(
texrun-engine:review-67)で build した(arm64、OrbStack)。サイズは展開後 856 MB、圧縮 251 MB で、PR 本文の数字と一致した - CI の sandbox job と同じ container テスト一式(
TEXRUN_TEST_BACKEND=container TEXRUN_REQUIRE_SANDBOX=1 TEXRUN_REQUIRE_TEXLIVE=1、texrun-sandbox / texrun-texlive の container・scenarios・security / texrun-preview の container・real_tools / texrun の container): すべて成功、ignored 0。common_packagesも成功 - sources job のログ:
texrun-engine-0.1.0-sources.tarは 1,299,312,640 B で、PR 本文と一致する。2 GiB 上限まで約 809 MiB の余裕がある cm-super-minimalの中身:.pfbは 41 個で、すべて 10pt(sfrm1000など)。cm-superは 369 個。不採用にした理由(11pt の文書、見出しのsfbx1440、脚注のtcrm0800)は正しい。cm-superはcm-super-minimalに依存しているので、両方が入る- より小さい代替があるか: 既定の OT1 / T1 文書が使うのは EC / TC(
ecrm/tcrm→sf*)なので、Latin Modern だけでは代わりにならない。cm-superは外せないと判断した。cm-super.t1cは 0 B(postinst が展開済み)なので、Type1 が二重に入ってはいない - ライセンス: image 内の
copyrightを見た。cm-super はGPL-2+ or GPL_Font_exception、Latin Modern は GUST Font License、pfb2t1c2pfbは GPL、xfonts-utilsなどは X11 系。表の内容は正しい。PSNFSS の Times などとして実際に埋め込まれるのは、texlive-fonts-recommendedのfonts/type1/urw/(NimbusRomNo9L など)だった MKTEXPK=0の方針と矛盾しない。下のとおり、生成された PDF の font はすべて埋め込みの Type 1 で、bitmap(Type 3)は 1 つも無い- dev image と engine image は、追加したパッケージが同じ。docs(development.md、security.md §3.4・§4、engine-image.md)の記述もそれと合っている
自分で compile した文書
engine image で、texrun と同じ環境変数を渡して(--network none --read-only、MKTEX*=0、openin_any=p など)latexmk を実行した。一部は texrun compile --backend container --container-image texrun-engine:review-67 でも実行した。
共通の本文: babel english、amsmath / amssymb / amsthm(theorem と proof)、textcomp の記号約 30 種(\textbullet \textdegree \texteuro \textcelsius \textohm \textperthousand \textonehalf ほか)、itemize / enumerate を 4 段まで入れ子にしたもの、description に itemize を入れたもの、\tiny から \Huge までの全サイズ、bf / it / sl / sf / tt / sc、アクセント付き文字、脚注、graphicx(PNG)、booktabs、geometry、microtype、hyperref(\url / \href / 参照)、\tableofcontents。
| 文書 | 結果 |
|---|---|
| article / report / book × 10 / 11 / 12pt × OT1 / T1(18 文書) | すべて成功。PDF の font はすべて埋め込みの Type 1 |
| T1 + lmodern、OT1 + lmodern | 成功、すべて Type 1 |
| T1 + times、OT1 / T1 + mathptmx + helvet + courier、T1 + mathpazo(sc,osf)、OT1 + palatino、T1 + helvet(sans を既定にする) | 成功、すべて Type 1 |
| microtype | どの文書でも Character protrusion enabled と Automatic font expansion enabled (level 2) が出た(OT1 と T1 の両方)。expansion に関する error や warning は無い |
| beamer(OT1 / T1) | 失敗。pgfmath.sty が無い(beamer.cls はあるが、pgf が無い。font とは関係ない) |
| siunitx | 失敗。siunitx.sty が無い(texlive-science) |
font の warning は、OT1/cmr/bx/sc・T1/lmr/bx/sc・T1/pplj/b/sc の Font shape undefined(太字の small caps)だけだった。これは CM / LM / Palatino にもともと無い shape なので、image の問題ではない。
beamer と siunitx は font の問題ではなく、この PR(#65)の範囲外。参考までにサイズを書いておく(trixie arm64 の Installed-Size)。texlive-pictures(pgf / TikZ、beamer に必要)は 82 MB で、依存で python3.13 が入るので sources tar も増える。texlive-science(siunitx)は 21 MB、texlive-latex-extra は 97 MB。入れるかどうかは別の Issue で決めればよいと思う。ただ、beamer.cls はあるのに使えない状態なので、少なくとも docs に「beamer / TikZ は未対応」と書いておくと親切。
nit
- fixture に mathpazo / palatino が無い: PR 本文と Dockerfile のコメントでは、
mathpazo(pplr7t)が修正前に失敗していたこと、Palatino を入れたことを書いている。しかしpsnfss.texは mathptmx / helvet / courier だけを試している。psnfss.texに\usepackage[sc]{mathpazo}を足すか、palatino.texを追加すると、書いていることと検証していることが一致する(Palatino の Type1 は urw/palatino で、Times とは別のファイル) - fixture に description が無い: Issue の観点(itemize / enumerate / description の入れ子)から見ると、
main.texにdescriptionを 1 つ入れておくとよい。font の観点では、description の見出しは bf なので、main.texの他の部分ですでに試せている。重要度は低い - ライセンス表で
cm-super-minimalが抜けている:cm-superはcm-super-minimalに依存していて、image にも入っている。表の行を`cm-super` / `cm-super-minimal`にすると、dpkg -lと照らし合わせやすい。ライセンスは同じ texlive-fonts-recommendedの行: 「the TeX Live fonts' own」だけだと、何のライセンスか分からない。PSNFSS で実際に埋め込まれるのは URW の Type1(fonts/type1/urw/、NimbusRomNo9L など)で、これは GPL(font exception 付き)。たとえば「mostly GPL with a font exception (the URW fonts)」のように書くと、下の「pdfTeX embeds subsets ...」の段落とつながる。そのうえで、段落の「The font exception of cm-super and the GUST Font License」に URW も含める- (任意)test の失敗メッセージ:
common_packagesは 4 文書をループで compile しているので、失敗したときにどの文書か分かるように、assert のメッセージの先頭にmainを入れるとよい(例:"{main}: {}")。今のdescribeの出力にも latexmk の stdout が含まれるので、そこから分かりはする - (任意)lmodern の AFM:
lmodernは/usr/share/texmf/fonts/afm/public/lmを 19 MB 持ってくるが、pdfTeX は AFM を使わない。path-exclude=/usr/share/texmf/fonts/afm/*を足すと展開後のサイズが約 19 MB 減る。ただし圧縮後は約 2.5 MB しか減らないので、やらなくてもよい
merge 後(v0.1.1)の注意(この PR の指摘ではない)
- engine-image workflow は、tag と
Cargo.tomlのworkspace.package.versionが一致しないと publish しない。v0.1.1 の tag を push する前に、version を 0.1.1 にする commit が必要になる texrun_sandbox::DEFAULT_IMAGEは texrun の version に紐づいていて、公開した tag は上書きしない方針になっている。そのため texrun 0.1.0 の利用者は、0.1.1 に上げるか--container-image ghcr.io/nishide-dev/texrun-engine:0.1.1を指定しないと直らない。release notes にそう書いておくとよい
… image Co-Authored-By: Claude Opus 5.5 <[email protected]>
…th backends Co-Authored-By: Claude Opus 5.5 <[email protected]>
…kages fixture Also name the cm-super-minimal and URW font licenses in docs/engine-image.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dev image now has the EC / TC fonts as Type1 (cm-super), so the fixture uses cmntt10, and the skill and docs/cli.md say which fonts work. Co-Authored-By: Claude Opus 5.5 <[email protected]>
82fb082 to
d863a0b
Compare
## 概要 v0.1.1 を公開するため、版を 0.1.1 に上げます。 ## 変更内容 - `Cargo.toml` の workspace と内部 crate の版を 0.1.1 に(`Cargo.lock` も更新) - README、docs/engine-image.md、skills/texrun/reference/setup.md の版表記を 0.1.1 に(docs/development.md のリリース手順の版表記も) v0.1.1 に含まれる主な変更: - engine image / dev image に Type1 font(cm-super、lmodern、texlive-fonts-recommended)を追加し、itemize や T1 を使う一般的な文書が compile できるように(#65、PR #67) - `!pdfTeX error:` を error diagnostic として報告し、失敗した compile には必ず error を返す(#66、PR #68) - Agent Skill と Claude Code の plugin marketplace(#63、PR #64) ## 確認方法 - [x] `cargo test --workspace --all-features --locked` - [x] `git grep -n '0\.1\.0' -- README.md docs/ skills/` で残りは履歴・説明上の記述のみ(release notes の初版の例、engine image 0.1.0 の不具合の説明) ## 補足 merge 後に main へ `v0.1.1` の tag を push し、engine image と release(notes 付き)を自動公開します。texrun 0.1.0 は既定で engine image 0.1.0 を使うため、font の修正を得るには texrun を 0.1.1 に上げる必要があります(release notes に追記予定)。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
概要
公開済みの engine image 0.1.0 と dev image では、普通の
itemizeを含む文書が!pdfTeX error: pdflatex (file tcrm1000): Font tcrm1000 at 600 not foundで失敗していた。両 image に Type1 font(cm-super・lmodern・texlive-fonts-recommended)を追加して直す。MKTEXPK=0(docs/security.md §3.4)の方針は変えていない。原因
LaTeX 2024-11-01(trixie の TeX Live 2024)では、OT1 文書の
\textbulletが\UseTextSymbol{TS1}になっている(\?\textbulletの定義で確認)。そのため\labelitemiを使うitemizeは TS1 のtcrm1000を必要とする。\usepackage[T1]{fontenc}の文書も EC のecrm1000を必要とするimage には
texlive-latex-baseの TFM(fonts/tfm/jknappen/ec/tcrm1000.tfm)だけが入っていて、Type1(.pfbと map)は入っていなかったtexrun は
MKTEXPK=0で bitmap(PK)を生成させないので、pdfTeX は font を埋め込めずに失敗する。PK を生成させずに Type1 を入れるのが正しい対処再現の結果(修正前)
itemizeだけtcrm1000not foundtcrm1000not found\usepackage[T1]{fontenc}+ microtypeecrm1000not foundlmodern+ 上記lmodern.stynot foundmathptmx/helvet/mathpazoptmr8t/pplr7tの TFM が無い既存の fixture が通っていた理由: どれも OT1 の本文だけで、
itemize・textcomp 記号・T1 を使っていなかった。OT1 の Computer Modern の Type1 はtexlive-base(amsfonts)に入っている変更内容
docker/engine/Dockerfileとdocker/dev/Dockerfile:texlive-fonts-recommended・cm-super・lmodernを追加した(--no-install-recommendsのまま)。理由はコメントに書いたcrates/texrun-texlive/tests/fixtures/common-packages/: 4 つの文書を追加したmain.tex: 11pt、OT1。入れ子の itemize、enumerate、textcomp 記号(脚注や\small/\Hugeの中でも使う)、amsmath/amssymb、graphicx(PNG)、booktabs、geometry、microtype、hyperreft1.tex: 12pt、T1。lmodern なしで cm-super をいろいろなサイズで使うlmodern.tex: T1 + lmodern + 上記のパッケージpsnfss.tex: mathptmx / helvet / courierpalatino.tex: mathpazo(sc,osf)main.texには description(中に itemize)も入れているscenarios.rsにcommon_packagesを追加した。5 文書が成功し、error と未解決の参照が無く、1 ページの PDF ができることを確認する。scenarios.rsは CI のintegrationjob(dev image で latexmk を host backend として実行)とsandboxjob(TEXRUN_TEST_BACKEND=container)の両方で走るので、両 backend を検証できる。engine-image workflow のverifyでも走る!pdfTeX error:の parser 対応)との整合pdftex-missing-fontは、cm-super が無いことを前提にしたecrm1000で失敗させていた。この PR で dev image に cm-super が入るので、Type1 の無いcmntt10(cmextra)を使う文書に変えた。log を再生成し、real_logs.rsの期待値とregenerate.shのコメントを更新した。ほかの log は timestamp しか変わらないので戻しているskills/texrun/reference/errors.mdと docs/cli.md の font 不足の例をcmntt10に変えた。errors.md は、Type1 のある font(既定の CM、T1、lmodern、mathptmx / helvet / mathpazo)に切り替えるよう案内する。itemize や T1 でも失敗するなら engine image 0.1.0 なので、新しい image を使うよう書いたcm-super/cm-super-minimal、URW の Type1 は GPL + font exception)、PDF への font 埋め込みについて追記した。development.md(dev image の内容と version)と security.md(§3.4・§4 の image 構成)も更新したパッケージの選定
cm-super-minimalitemizeの 10pt 文書は通るが、11pt 文書・見出し(sfbx1440)・脚注(tcrm0800)で失敗するので不採用cm-superpfb2t1c2pfblmodernlmodernは既存のfonts-lmodernと同じ。xfonts-utilsなどが約 2 MiB)\usepackage{lmodern}は T1 文書の定番なので採用。font 本体のfonts-lmodernはもともとtexlive-latex-baseの依存で入っていて、LaTeX 用のファイル(sty/fd/tfm)だけが無かったtexlive-fonts-recommendedtexlive-baseは既存)tex-gyreなどcm-superは GPL-2.0-or-later(font exception 付き)、Latin Modern は GUST Font License(LPPL の変種)。依存のpfb2t1c2pfbは GPL、xfonts-utils/xfonts-encodings/libfontencは MIT / X11。いずれも PDF への font 埋め込みは許されているcm-super、pfb2t1c2pfb、xfonts-utils、xfonts-encodings、libfontencの 5 つ(dpkg-queryの差分で確認)サイズ
確認方法
cargo check --workspace --all-targets --all-features --lockedcargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test --workspace --all-features --locked(host)TEXRUN_REQUIRE_TEXLIVE=1 TEXRUN_REQUIRE_PREVIEW_TOOLS=1 cargo test --workspace --all-features --locked: 全部成功TEXRUN_TEST_BACKEND=container TEXRUN_REQUIRE_SANDBOX=1 TEXRUN_REQUIRE_TEXLIVE=1): 全部成功、ignored 0common_packagesがFont tcrm0900 at 600 not foundで失敗することを確認したpdffontsで見るとすべて Type 1 だった(bitmap は無い)関連 Issue
Closes #65
修正版 image の公開(v0.1.1 の tag push と release)は、merge 後に owner の判断で行う。この PR では公開しない。
補足
!pdfTeX error:の行が parser で拾われない)。parser 側は Report pdfTeX errors that the log parser misses #66 で扱っているので、この PR では触っていない🤖 Generated with Claude Code