* Exporting Org Agenda to PDF with Cyrillic Characters
@ 2024-09-07 20:42 Serghei Iakovlev via Users list for the GNU Emacs text editor
0 siblings, 0 replies; only message in thread
From: Serghei Iakovlev via Users list for the GNU Emacs text editor @ 2024-09-07 20:42 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I’m reaching out because I’ve hit a wall after spending many hours
debugging what seemed like a straightforward issue but turned out to
be a rabbit hole. I’ve been working on customizing `org-agenda'
export to PDF and initially thought my problem was related to
`ox-texinfo'. I spent half the night tweaking my Emacs
configuration, digging through documentation, and adjusting settings
in hopes of resolving the issue. I went down a lot of wrong paths
before realizing that `org-store-agenda-views' doesn't actually call
`ox-texinfo'. That was my first mistake - not diving into the source
code earlier.
Turns out, the function calls `org-agenda-write`, which in turn
executes something entirely different. Relevant part of
org-agenda.el:
--8<---------------cut here---------------start------------->8---
(require 'ps-print)
(ps-print-buffer-with-faces
(concat (file-name-sans-extension file) ".ps"))
(call-process "ps2pdf" nil nil nil
(expand-file-name
(concat (file-name-sans-extension file) ".ps"))
(expand-file-name file))
(delete-file (concat (file-name-sans-extension file) ".ps"))
(message "PDF written to %s" file)
--8<---------------cut here---------------end--------------->8---
So, after realizing this, I thought I could fix the issue by tweaking
`ps-print' and `ps2pdf' settings. I’ve tried adjusting my
`org-agenda-exporter-settings' multiple times, setting various font
families and print headers, and I’ve seen some changes reflected in
the output. For instance, I can see that the header is removed, and
the font face in the PDF actually changes when I tweak
`ps-font-family'. But no matter what I try, Cyrillic characters
still show up as question marks or garbled symbols.
Here’s a snippet of my best try:
--8<---------------cut here---------------start------------->8---
(setq org-agenda-exporter-settings
'((ps-multibyte-buffer 'bdf-font-except-latin)
(ps-print-header nil)
(ps-print-color-p 'black-white)
(ps-font-family 'Helvetica)
(htmlize-output-type 'css)))
--8<---------------cut here---------------end--------------->8---
I’ve tried changing `ps-multibyte-buffer' to `bdf-font-except-latin',
thinking it would handle non-Latin characters, but that hasn’t
worked. I’ve messed around with various `ps-font-family' values, tried
specifying paths to BDF fonts, and set up `bdf-directory-list', but
still no dice. I’ve also been battling with `ps2pdf', which seems to
completely ignore the fonts I’m trying to set up, reverting to
something that just doesn’t support Cyrillic.
As far as I can tell, `ps-mule' expects me to install BDF fonts and set
the path to them in `bdf-directory-list'. If this is indeed the reason
why I’m seeing garbled text instead of proper characters, then my
situation might be even worse. The workstation I’m working on is
running macOS, and as far as I know, there's no native support for
pcf/bdf fonts in macOS. At least, I've never heard of anyone using
these on macOS. So, what started as a simple task to add a weekly
report generation function is turning into a bottomless rabbit hole,
and I can’t help but feel like I’m missing something fundamental
here.
Running pdffonts (a part of the poppler package on macOS) on the
generated document gives me the following output:
--8<---------------cut here---------------start------------->8---
name type encoding emb sub uni object ID
------------------- ---------- ---------- --- --- --- ---------
YJXYOF+Helvetica Type 1C WinAnsi yes yes no 7 0
--8<---------------cut here---------------end--------------->8---
From what I understand, WinAnsi is essentially cp1252. I have
absolutely nothing related to cp1252 in my Emacs config. Could this
be ghostscript that's involved in the conversion process messing
things up? I’m really lost at this point. Why is cp1252 even showing
up here when I’m not on Windows?
Many hours of debugging and trying different approaches, I’m still
stuck. It feels like I’m missing something obvious, but at this
point, I’m exhausted and just need fresh eyes on this. If anyone has
insights or suggestions on how to get ps-print to correctly handle
Cyrillic characters or ensure that `ps2pdf' doesn’t mess up the
fonts, I’d really appreciate your help. This has been a frustrating
journey, and I’d love to hear how others have tackled similar issues.
--
Serghei Iakovlev
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-09-07 20:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-07 20:42 Exporting Org Agenda to PDF with Cyrillic Characters Serghei Iakovlev via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).