feat: package fonts for more invoice PDF languages (Hebrew, Thai, Lao, Khmer, Myanmar, Sinhala, Kannada, Telugu, Sindhi)
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
Summary
Package fonts so invoice PDFs render Hebrew, Thai, Lao, Khmer, Myanmar, Sinhala, Kannada, Telugu and Sindhi. Fonts stay packaged in the plugin. There are no on-demand downloads in this issue.
Follow-up to #1925, #2030 (PR #2035) and #2037 (PR #2038). #2038 added a pre-render check, Invoice::get_unsupported_scripts(). It uses mPDF's own script database and font mapping, and fails early with a clear, admin-visible error when the font mPDF would select for a script is not on disk. Once a font file is retained, that script passes the check with no code change. So this issue is mainly about which mPDF font files to stop stripping.
Background (verified against mPDF 8.3.1)
scripts/remove-mpdf-fonts.php deletes mPDF's non-Latin fonts. It runs from the composer post-install-cmd and post-update-cmd hooks. Every build path goes through it: package.json prebuild (composer install -o --no-dev), release.yml, CI and bin/deploy.sh. Editing its $fonts list is the single control point.
The original mPDF package, as cached by composer, gives exact sizes. Today the plugin ships about 2.9 MB of fonts (DejaVu Sans/Serif Condensed regular and bold, FreeMono, Eeyek).
Scope: fonts to retain (from mPDF's own bundle, about 1.76 MB uncompressed in total)
| Script | mPDF font name | Files to keep | Size |
|---|---|---|---|
| Hebrew | taameydavidclm |
TaameyDavidCLM-Medium.ttf, TaameyDavidCLM-LICENSE.txt |
96 KB |
| Thai | garuda |
Garuda.ttf, Garuda-Bold.ttf |
113 KB |
| Lao | dhyana |
Dhyana-Regular.ttf, Dhyana-Bold.ttf, DhyanaOFL.txt |
134 KB |
| Khmer | khmeros |
KhmerOS.ttf, KhmerOFL.txt |
266 KB |
| Myanmar (and Tai Le) | tharlon |
Tharlon-Regular.ttf, TharlonOFL.txt |
353 KB |
| Sinhala | kaputaunicode |
kaputaunicode.ttf |
160 KB |
| Kannada | lohitkannada |
Lohit-Kannada.ttf, LohitKannadaOFL.txt |
198 KB |
| Telugu | pothana2000 |
Pothana2000.ttf |
194 KB |
| Sindhi | lateef |
LateefRegOT.ttf, Lateef font OFL.txt |
246 KB |
Notes:
- mPDF's
fontdatafor most of these defines only the regular style. Garuda has regular, bold, oblique and bold-oblique, and Dhyana has regular and bold. The invoice template uses<strong>(company name, headings), so bold and italic markup must not throwFont "..." is not supported. For each retained family, check which ofR/B/I/BImPDF'sfontdatadefines. Where a style is missing, or its file is not retained, add a remap inInvoice::get_missing_fontdata()to a retained file. Use the existingdejavusansmono,dejavusansanddejavuserifentries as the pattern. Do not retain Garuda's two oblique files (57 KB each); remapIandBItoRandB. - Keep the licence texts listed above next to the fonts they cover. Before retaining each font, confirm it may be redistributed. mPDF already distributes these files, but Garuda,
kaputaunicodeandPothana2000ship without a licence text inttfonts/. If redistribution terms are unclear for any font, leave it stripped and say so in the PR.
Files
scripts/remove-mpdf-fonts.php: remove the listed font and licence file names from$fonts. Add a comment pointing to this issue. Keep a note that retained fonts must keep all fourfontdatastyles resolvable.inc/invoices/class-invoice.php: remaps inget_missing_fontdata()for missing styles only.tests/WP_Ultimo/Invoices/Invoice_Test.php: extend the existing tests. #2038 addedtest_get_unsupported_scriptsandtest_pdf_with_unsupported_script_throws_clear_error. Hebrew and Thai are in those tests as examples of unsupported scripts, so move them to a "supported" assertion and pick a still-unsupported script (for example Devanagari) for the failure case.
Reference patterns: Invoice::get_missing_fontdata() and Invoice::get_unsupported_scripts().
Out of scope (separate decisions, not part of this issue)
- Devanagari, Bengali, Gujarati, Gurmukhi, Tamil, Malayalam, Oriya, Thaana: mPDF selects
freeserif, which is 3.3 MB regular plus 1.3 MB bold (about 4.6 MB for regular and bold). This needs a size decision, or a spike on smaller per-script fonts. Noto per-script fonts are a candidate but have not been tested with mPDF's OpenType shaper. - CJK: with
+aCJK, mPDF uses non-embedded Adobe CJK fonts, so most viewers and phones show blanks. Embedded fonts are large (Sun-ExtAis 23 MB,UnBatangis 6.9 MB). This is its own decision. - Tibetan (
jomolhari, 2.3 MB), Syriac (OTF file), Ethiopic (619 KB) and historical scripts. - On-demand or downloadable font packs.
Verification
- For each script in the table, generate a PDF through the real
WP_Ultimo\Invoices\Invoiceclass with sample text in the company name (bold via<strong>) and in a line item title. Render it withpdftoppmand inspect the image for correct glyph shaping, joining and ordering. A PDF header alone is not evidence. Suggested samples are in the #2037 PR body andInvoice_Test. Invoice::get_unsupported_scripts()returns[]for each of these scripts.- Bold and italic markup does not throw for any retained family.
vendor/bin/phpunit --filter 'Invoice_Test|Email_Manager_Test|Payment_Manager_Test',vendor/bin/phpcson the changed files,vendor/bin/phpstan analyse, andgit diff --check.- Measure the packaged size change (
duofvendor/mpdf/mpdf/ttfonts/before and after, and the built ZIP if practical) and record it in the PR. The expected increase is about 1.8 MB uncompressed. composer install --no-devstill ends with only the intended fonts present.
- 主要言語
- PHP
- スター
- 218
- フォーク
- 87
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 109
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Ultimate-Multisite/ultimate-multisite のほかの issue
-
fix: send payment_received receipt after manual payment confirmation and email verification対応中かも @superdav42 が 2 日前に担当しました。 オープンbug origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2055 · コメント 12 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
perf: lazy-load the top My Sites toolbar and defer initial site-list hydration再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンenhancement origin:worker priority:medium source:conflict-feedback status:available tier:standard
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Ultimate-Multisite/ultimate-multisite#2015 · コメント 125 件 ·
メンテナーはふだん 1 日以内に返信
-
auto-dispatch needs-investigation origin:worker security status:available tier:standard type:bug
難易度 3/5 半日 初心者へのやさしさ 30/100
Ultimate-Multisite/ultimate-multisite#1930 ·
メンテナーはふだん 1 日以内に返信
-
hold-for-review no-auto-dispatch origin:interactive status:available type:bug
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Ultimate-Multisite/ultimate-multisite#1892 ·
メンテナーはふだん 1 日以内に返信
-
auto-dispatch hold-for-review origin:worker review-followup source:review-scanner status:available tier:standard
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
Ultimate-Multisite/ultimate-multisite#1867 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
Ultimate-Multisite/ultimate-multisite の issue をすべて見る
似ている issue
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Перевод устарел
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
fix(proxy): avoid exposing Reverb HTTP API (/apps) publicly in generated Traefik dynamic configオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
coollabsio/coolify#12390 ·
メンテナーはふだん 1 日以内に返信
-
win_build: parallel PostBuildEvent race in example_app_atiopencl and example_app_nvopencl copying openclapp_kernels.cl対応中かも @qixuancao が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信