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; 6+ 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] 6+ messages in thread

* bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2024-09-10  6:19 UTC (permalink / raw)
  To: Serghei Iakovlev; +Cc: 73161

Serghei Iakovlev via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

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

(A comment to Eli and other Emacs maintainers)

I believe that what we observe here is a problem in `ps-print-buffer',
not in Org mode. In other words, it looks like Emacs bug, not Org mode
bug.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters
  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: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
  1 sibling, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-09-10 13:51 UTC (permalink / raw)
  To: Serghei Iakovlev; +Cc: 73161

> Date: Mon, 09 Sep 2024 22:38:13 +0000
> From:  Serghei Iakovlev via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 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---

IMO, Org should document that org-agenda-write uses ps-print and
ps2pdf, so that users could know where to look for cause of trouble
and which parts to customize to work around these problems.

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

I don't know about ps2pdf, but I did at one time, years ago, have a
working setup that was capable of using ps-print to print Cyrillic
text from Emacs to a PostScript printer.  I will try to describe what
I think I did back then, using my old files and archives to recollect
stuff I've long forgotten, in the hope it will help you.

> As far as I can tell, `ps-mule' expects me to install BDF fonts and set
> the path to them in `bdf-directory-list'.

Yes.  Here's what I had back when I printed Cyrillic text using
ps-print:

  (setq ps-multibyte-buffer 'bdf-font-except-latin)
  (setq bdf-directory-list (list (concat invocation-directory "../fonts/bdf")))

(The value of bdf-directory-list is just my personal choice back then:
you can have any directory there, just make sure the BDF fonts arfe
really in that directory.  But it must be a list, even if you just
have a single directory.)

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

The BDF fonts I used are from the GNU Intlfonts.  I think they are the
only ones that are guaranteed to work with ps-mule and ps-bdf, or at
least worked in the past (see below).  AFAICT, you can still download
them from here:

  https://ftp.gnu.org/gnu/intlfonts/intlfonts-1.2.1.tar.gz

When you unpack the tarball, chdir to the intlfonts-1.2.1 created by
unpacking, and type:

  $ make bdf INSTALLDIR=/path/to/where/to/install

This should install the BDF fonts in the specified directory, and you
should point bdf-directory-list to it.  (You can delete the
intlfonts-1.2.1 tree after you do the above.)

AFAIR, this was all I needed back then; I hope I don't misremember.

However: I last used this with Emacs 21, which is before Emacs was
converted to Unicode-based treatment of non-ASCII characters.  So it
is possible that the above will not work with the current codebase,
because ps-mule needs to decide which of the BDF fonts to use for each
script (in your case Cyrillic), and I just don't remember if this code
was adjusted to the changes we made in Emacs 23 (I think it was, but I
am not sure).

And finally: the situation with ps-print wrt non-ASCII text is not a
good one.  Even if BDF fonts still work, they are somewhat ugly, and
are nowadays almost unsupported by systems, so it is hard to find nice
BDF fonts.  And ps-mule doesn't support anything else.  There were
plans to write ps-type1 to support Type1 fonts, but it never happened.

Unfortunately, this basically means that any Lisp program that builds
on ps-print will only reasonably support ASCII and Latin-1 text, the
rest of scripts will need to use BDF fonts, and will probably not look
very nice.  IMO, Org should document this limitation as well.

What ps2pdf will do with the PS files created by ps-print under the
above setup, I don't know.  Don't hold your breath.

HTH, and sorry for your journey down this rabbit hole.





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

* bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters
  2024-09-10  6:19 ` Ihor Radchenko
@ 2024-09-10 13:53   ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-09-10 13:53 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 73161, egrep

> Cc: 73161@debbugs.gnu.org
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Tue, 10 Sep 2024 06:19:41 +0000
> 
> Serghei Iakovlev via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
> 
> > --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---
> 
> (A comment to Eli and other Emacs maintainers)
> 
> I believe that what we observe here is a problem in `ps-print-buffer',
> not in Org mode. In other words, it looks like Emacs bug, not Org mode
> bug.

It isn't an Org bug, but IMO Org should prominently document that the
above is only going to work for ASCII and maybe also Latin-1 text; any
other scripts, if they at all work, need ps-mule setup and BDF fonts.





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

* bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-09-10 14:45 UTC (permalink / raw)
  To: egrep; +Cc: 73161

> Cc: 73161@debbugs.gnu.org
> Date: Tue, 10 Sep 2024 16:51:28 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> However: I last used this with Emacs 21, which is before Emacs was
> converted to Unicode-based treatment of non-ASCII characters.  So it
> is possible that the above will not work with the current codebase,
> because ps-mule needs to decide which of the BDF fonts to use for each
> script (in your case Cyrillic), and I just don't remember if this code
> was adjusted to the changes we made in Emacs 23 (I think it was, but I
> am not sure).

Bad news: I tried that, and it doesn't seem to work.  I guess
something is missing in ps-mule.el to do the job in the current Emacs,
sigh...





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

* bug#73161: 29.4; Exporting Org Agenda to PDF with Cyrillic Characters
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Serghei Iakovlev via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-11 12:02 UTC (permalink / raw)
  To: 73161; +Cc: Ihor Radchenko, Eli Zaretskii


> IMO, Org should document that org-agenda-write uses ps-print and
> ps2pdf, so that users could know where to look for cause of trouble
> and which parts to customize to work around these problems.

I agree with you.  Things would have been a bit simpler, and perhaps
even friendlier, if I had stumbled upon this information right away.
I'd like to take this opportunity to address Ihor and kindly ask him
to consider reviewing and enhancing the documentation related to this
matter.

> When you unpack the tarball, chdir to the intlfonts-1.2.1 created by
> unpacking, and type:
>
>   $ make bdf INSTALLDIR=/path/to/where/to/install
>
> This should install the BDF fonts in the specified directory, and you
> should point bdf-directory-list to it.  (You can delete the
> intlfonts-1.2.1 tree after you do the above.)

Looks like it works something like this:

--8<---------------cut here---------------start------------->8---
% ./configure --prefix=~/.local
creating cache ./config.cache
checking for a BSD compatible install... /opt/homebrew/bin/ginstall -c
checking where fonts should go... ~/.local/share/emacs/fonts
checking whether to compress fonts or not... no
checking installing font types...  pcf bdf
updating cache ./config.cache
creating ./config.status
creating Makefile
--8<---------------cut here---------------end--------------->8---

and then just:

--8<---------------cut here---------------start------------->8---
% make bdf
% ls -1 ~/.local/share/emacs/fonts/bdf | wc -l
     137
--8<---------------cut here---------------end--------------->8---


> And finally: the situation with ps-print wrt non-ASCII text is not a
> good one.  Even if BDF fonts still work, they are somewhat ugly, and
> are nowadays almost unsupported by systems, so it is hard to find nice
> BDF fonts.  And ps-mule doesn't support anything else.  There were
> plans to write ps-type1 to support Type1 fonts, but it never happened.

Oh my, they are indeed hideous! I suspected you were being quite
diplomatic by calling them "somewhat ugly," but I had no idea just
how bad they actually were!  It’s honestly so awful that my manager
would rather not know my weekly status than read it with these fonts

Jokes aside, the second thing I’d like to propose is to start a
discussion about reviving the Type1 font support project.  This seems
like an important and mature step forward, considering we’re in the
21st century, and the era of display resolutions reminiscent of a
microwave OLED screen is long behind us.

> Unfortunately, this basically means that any Lisp program that builds
> on ps-print will only reasonably support ASCII and Latin-1 text, the
> rest of scripts will need to use BDF fonts, and will probably not look
> very nice.  IMO, Org should document this limitation as well.

I'm curious how feasible it would be to extend Org to rework the PDF
generation flow, for example, to something like Org -> TeX -> PDF,
similar to how pandoc handles it.  This is my second question
addressed to Ihor.

> HTH, and sorry for your journey down this rabbit hole.

Thank you for your explanations and kind words of support—I really
appreciate it.

-- 
Serghei Iakovlev






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

end of thread, other threads:[~2024-09-11 12:02 UTC | newest]

Thread overview: 6+ 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

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