unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters
@ 2024-09-09 22:38 Serghei Iakovlev via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-09-10  6:19 ` Ihor Radchenko
  2024-09-10 13:51 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Serghei Iakovlev via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 22:38 UTC (permalink / raw)
  To: 73161

Hello,

Meta: This message was originally posted to the help-gnu-emacs
mailing list, but I suspect that it may have gone unanswered because
it wasn’t the right place for this kind of query.  Please feel free
to ignore this message here and reply on the mailing list if that’s
more appropriate.

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

--

In GNU Emacs 29.4 (build 1, aarch64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2024-08-02 built on
 armbob.lan
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.6.1

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules 'CFLAGS=-DFD_SETSIZE=10000
 -DDARWIN_UNLIMITED_SELECT' --with-x-toolkit=no'

Configured features:
ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS
PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org-Agenda  Ddl Grid Habit +issue

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  hl-line-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-netsplit-mode: t
  which-key-mode: t
  save-place-mode: t
  savehist-mode: t
  recentf-mode: t
  winner-mode: t
  windmove-mode: t
  electric-pair-mode: t
  vertico-prescient-mode: t
  prescient-persist-mode: t
  vertico-mode: t
  marginalia-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-spelling-mode: t
  erc-services-mode: t
  erc-autojoin-mode: t
  erc-log-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  pixel-scroll-precision-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/Users/serghei/.emacs.d/elpa/transient-0.7.4/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient

Features:
(man misearch multi-isearch shadow emacsbug conf-mode debug backtrace
flow-fill org-attach warnings timezone sql-indent sql view pulse xref
ob-ditaa ob-plantuml org-clock org-colview org-ctags org-habit
org-mouse org-plot org-protocol ox-odt ox-latex ox-icalendar ox-html
table ox-ascii ox-publish ox embark-org embark-consult embark
shr-color shortdoc url-http url-gw url-cache url-auth org-mobile
display-line-numbers consult-imenu display-fill-column-indicator
cl-print help-fns radix-tree holidays holiday-loaddefs cal-move
org-contacts tabify org-capture vc-hg vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs log-view vc bug-reference magit-extras magit-bookmark
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func magit-diff smerge-mode diff git-commit log-edit pcvs-util
add-log magit-core magit-autorevert autorevert magit-margin
magit-transient magit-process magit-mode transient benchmark
magit-git magit-base magit-section crm misc rng-xsd xsd-regexp
rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap nxml-util nxml-enc xmltok consult bookmark pcmpl-unix vc-git
diff-mode vc-dispatcher sh-script executable mhtml-mode rainbow-mode
css-mode smie js c-ts-common sgml-mode facemenu htmlize cl cal-iso
org-archive face-remap org-agenda mailalias smtpmail writegood-mode
image-file image-converter org-indent oc-basic ffap org-element
org-persist org-id avl-tree generator ol-eww eww xdg url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect ol-docview doc-view
filenotify jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m
ol-doi org-link-doi org-refile sort gnus-cite smiley qp mm-archive
mail-extr textsec uni-scripts idna-mapping uni-confusable
textsec-check gnus-async gnus-bcklg gnus-ml disp-table gnus-topic
hl-line nndraft nnmh utf-7 nnfolder gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view
mml-smime smime gnutls dig nntp gnus-cache gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus
dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec
gnus-int gnus-range message sendmail yank-media dired dired-loaddefs
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win
gnus nnheader gnus-util text-property-search mail-utils range mm-util
mail-prsvr network-stream puny nsm erc-list erc-menu erc-ring
erc-pcomplete erc-netsplit cursor-sensor rainbow-delimiters which-key
saveplace savehist recentf tree-widget winner windmove elec-pair
vertico-prescient prescient char-fold orderless vertico marginalia
sqlite-mode erc-track erc-match erc-spelling flyspell-correct edmacro
kmacro flyspell erc-services erc-join erc-log erc-hl-nicks color
erc-button erc-fill erc-stamp wid-edit erc-goodies erc thingatpt pp
erc-backend erc-networks erc-common erc-compat erc-loaddefs diary-lib
diary-loaddefs pixel-scroll cua-base modus-vivendi-theme modus-themes
parse-time iso8601 org-cliplink org-cliplink-transport
org-cliplink-string em-glob esh-util files-x org-crypt ob-calc
calc-store calc-trail calc-ext calc calc-loaddefs rect calc-macs
ob-sql ob-shell ob-scheme ob-python python project pcase treesit
ob-org ob-makefile ob-lisp ob-latex ob-js ob-haskell ob-C cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-src ob-comint org-pcomplete org-list org-footnote
org-faces org-entities time-date noutline outline icons ob-emacs-lisp
ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core
org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs
org-version org-compat org-macs format-spec pass f dash s imenu
password-store auth-source-pass with-editor cl-extra help-mode shell
pcomplete comint ansi-osc ansi-color ring server compat compat-30
epa-file epa derived epg rfc6068 epg-config bind-key easy-mmode
ispell benchmark-init advice finder-inf info anaconda-mode-autoloads
benchmark-init-autoloads consult-flyspell-autoloads
csv-mode-autoloads embark-consult-autoloads consult-autoloads
embark-autoloads erc-hl-nicks-autoloads flyspell-correct-autoloads
git-modes-autoloads ht-autoloads htmlize-autoloads magit-autoloads
git-commit-autoloads magit-section-autoloads marginalia-autoloads
markdown-mode-autoloads orderless-autoloads org-cliplink-autoloads
org-contacts-autoloads pass-autoloads password-store-otp-autoloads
password-store-autoloads pythonic-autoloads f-autoloads
rainbow-delimiters-autoloads rainbow-mode-autoloads
sql-indent-autoloads transient-autoloads ts-autoloads s-autoloads
dash-autoloads vertico-prescient-autoloads vertico-autoloads
prescient-autoloads which-key-autoloads with-editor-autoloads
compat-autoloads writegood-mode-autoloads yaml-mode-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib early-init rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer
select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 2084578 636181)
 (symbols 48 57543 21)
 (strings 32 303573 51904)
 (string-bytes 1 8578847)
 (vectors 16 123487)
 (vector-slots 8 2388934 819475)
 (floats 8 1987 2531)
 (intervals 56 104710 12178)
 (buffers 984 94))







^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-24 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-09 22:38 bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters Serghei Iakovlev via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10  6:19 ` Ihor Radchenko
2024-09-10 13:53   ` Eli Zaretskii
2024-09-10 13:51 ` Eli Zaretskii
2024-09-10 14:45   ` Eli Zaretskii
2024-09-11 12:02   ` Serghei Iakovlev via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-24 17:41     ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).