feat: warn when a PDF export replaces characters it cannot draw

The hand-written PDF writer uses the standard Courier fonts
(WinAnsiEncoding), so any character outside CP1252 - a Polish, Greek,
Cyrillic or CJK script - was silently written as '?'. Render now
collects the characters it had to replace and returns them, and the
export dialog lists them in a warning once the file is written.

Embedding a TrueType font (e.g. Courier Prime) with a CID/ToUnicode
map would fix the root cause; the warning keeps the zero-dependency
trade-off honest in the meantime.
This commit is contained in:
Kharec committed 2026-10-15 17:49:53 +02:00
1 parent 5e7ae97b57
commit e80ad634ef
7 files changed
+125 -35

No files matched your search

+1 -1
View File
@@ -277,7 +277,7 @@ func pdfOutput(src, tmp, path string) error {
pages := append([]layout.Page{layout.TitlePage(doc.TitlePage, doc.Settings.Paper)},
layout.Paginate(doc, layout.Options{SceneNumbers: true}).Pages...)
var b bytes.Buffer
if err := pdf.Render(&b, pages, pdf.Options{Title: doc.TitlePage.Title, Author: doc.TitlePage.Author}); err != nil {
if _, err := pdf.Render(&b, pages, pdf.Options{Title: doc.TitlePage.Title, Author: doc.TitlePage.Author}); err != nil {
return err
}
file := filepath.Join(tmp, "sample.pdf")