mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-18 10:44:08 +00:00
Add multilingual PDF font system with Noto Sans and on-demand CJK packages
Bundle Noto Sans (Regular/Bold/Italic/BoldItalic) under resources/static/fonts/ as the default PDF face — it covers Latin, Cyrillic, Greek, Arabic, Thai and Hindi out of the box, replacing the limited DejaVu Sans fallback. Move all @font-face declarations into app.pdf.partials.fonts and include it from every invoice/estimate/payment/report template, dropping per-template font-family hardcodes and the conditional Thai locale include.
Introduce FontService + FontController to download static Noto Sans CJK packages (zh, zh_CN, ja, ko) from life888888/cjk-fonts-ttf on demand. GeneratesPdfTrait::ensureFontsForLocale primes the family before rendering and the partial emits @font-face rules for installed packages so dompdf resolves them through standard CSS — no separate registerFont() instance required. Static TTFs are mandatory because dompdf's PHP-Font-Lib does not parse variable fonts (fvar/gvar tables), which is why Google Fonts' NotoSansTC[wght].ttf rendered empty boxes.
Expose status/install via /api/v1/fonts/status and /api/v1/fonts/{package}/install with matching FONTS_STATUS / FONTS_INSTALL constants in scripts-v2/api/endpoints.ts. Flip DOMPDF_ENABLE_REMOTE default to true for remote asset loading.
This commit is contained in:
@@ -122,6 +122,10 @@ export const API = {
|
||||
BACKUPS: '/api/v1/backups',
|
||||
DOWNLOAD_BACKUP: '/api/v1/download-backup',
|
||||
|
||||
// Fonts
|
||||
FONTS_STATUS: '/api/v1/fonts/status',
|
||||
FONTS_INSTALL: '/api/v1/fonts',
|
||||
|
||||
// Exchange Rates & Currencies
|
||||
CURRENCIES: '/api/v1/currencies',
|
||||
CURRENCIES_USED: '/api/v1/currencies/used',
|
||||
|
||||
Reference in New Issue
Block a user