Thread View: linux.debian.bugs.dist
1 messages
1 total messages
Started by Edmund Christian Herenz
Mon, 12 Oct 2026 12:00
Bug#878142: muttprint: some non-ASCII characters are silently missing from the generated .ps file
Author: Edmund Christian Herenz
Date: Mon, 12 Oct 2026 12:00
Date: Mon, 12 Oct 2026 12:00
159 lines
7945 bytes
7945 bytes
--76i73lsczot7nqay
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
this bug is paining me since forever now, and even after tinkering I
don't have the right solution, but a least a solution that works for
me (mostly).
Seeing that this bug now will have it's tenth anniversary soon, and
given that nothing ever will happen upstream anymore with this big
hack for a niche audience, I post my patch here for inspiration.
But, it's not meant to be *the patch* that fixes this bug once and
forever. (Note that the main mono font in my patch is also Julia
Mono, which is not distributed by debian.)
On Tue, 10 Oct 2017 15:55:36 +0200 Vincent Lefevre <vincent@vinc17.net> wrote:
> I think that the easiest solution would be to use xelatex and
> a font that the required characters (DejaVu Sans Mono seems one
> of the most complete fonts).
>
> I've attached a patch that does this (mainly for testing), but
> I haven't tried in non-UTF8 locales (I suppose that the input
> should be converted to UTF8 or \XeTeXinputencoding should be
> used) and the font is hardcoded in the patch.
So this patch did nothing for me, a lot of UTF-8 characters in the
mail body were still rendered as boxes.
In my setting I have to deal with utf-8 mails that contain
mathematical symbols, various Indic scripts, and also Japanese. From
my understanding, there is no one-fits-all UTF-8 rendering solution
that muttprint could use as a template.
For my purpose I now switched to lulatex as the latex backend, and I
come up with some fall-back chain in lua ... the list of fallbacks should be
increased for more general cases maybe?
(Also, some emails that contain a lot of Japanese and rarer characters
still fail to print.)
Here is the way I use muttprint in my .muttrc:
set print_command='set -e; f=`mktemp`; \
/home/edmundherenz/bash-scripts/ciscoclean.sh | muttprint \
--penguin /usr/share/ospics/BabyTuX.png -P A4 -p TO_FILE:"$f"; \
okular "$f"; rm "$f"'
CH.
--
Edmund Christian Herenz
Inter-University Centre for Astronomy and Astrophysics, Pune, India
Phone: ++91 (0)20 25604 109
Web: https://web.iucaa.in/~edmund.herenz/
--76i73lsczot7nqay
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="muttprint-utf8_v2.patch"
--- a/muttprint
+++ b/muttprint
@@ -177,7 +177,7 @@
my %Header; # Header ...
my @PrintedMailheaders; # Mailheader so wie er gedruckt wird (LaTeX-Code)
my $childPid; # PID des Kinds
-my $DVIopts; # Optionen fuer DVI - Aufruf
+my $PDFopts; # Optionen fuer PDF - Aufruf
my @Command; # Kommando zum Drucken; fuer Druck in Datei
my $Laenge = "0"; # zum Ermitteln der laengsten Zeile
my $MaxLaenge = "0"; # die laengste Zeile
@@ -583,13 +583,14 @@
#
# running latex twice because of the "page ... of ..."
-system("latex -interaction=nonstopmode mail.tex >> $errorRedirection 2>&1");
-system("latex -interaction=nonstopmode mail.tex >> $errorRedirection 2>&1");
+for (1..2) {
+ system("lualatex --jobname=mail -file-line-error -interaction=nonstopmode mail.tex >> $errorRedirection 2>&1");
+}
#
# no check of the exit code because we do this here
-unless (-e $Temp{dvi}) {
- fatalError "Latex didn't work. There's no DVI file. If you ".
+unless (-e $Temp{pdf}) {
+ fatalError "Latex didn't work. There's no PDF file. If you ".
"write a bugreport, please include a mail where printing fails.";
}
@@ -599,8 +600,8 @@
#
# generating the postscript file in every case
-system("dvips -t $paperformat -o $Temp{ps} $Temp{dvi} >> $errorRedirection 2>&1")
- and fatalError "Error while running dvips:\n$!";
+system("pdftops $Temp{pdf} $Temp{ps} >> $errorRedirection 2>&1")
+ and fatalError "Error while running pdftops:\n$!";
# now we find out the number of pages the document has
@@ -1163,11 +1164,11 @@
}
}
- $Temp{dir} = tempdir("muttprint-XXXXXX", TMPDIR => 1, CLEANUP => 1);
+ $Temp{dir} = tempdir("muttprint-XXXXXX", TMPDIR => 1, CLEANUP => 0);
$Temp{content} = "$Temp{dir}/content";
$Temp{latex} = "$Temp{dir}/mail.tex";
$Temp{logf} = "$logf";
- $Temp{dvi} = "$Temp{dir}/mail.dvi";
+ $Temp{pdf} = "$Temp{dir}/mail.pdf";
$Temp{ps} = "$Temp{dir}/mail.ps";
$Temp{psnew} = "$Temp{dir}/mail-new.ps";
$Temp{ps1} = "$Temp{dir}/mail1.ps";
@@ -1386,14 +1387,27 @@
output \*LATEX, "
\\documentclass[compat2,$Config{FONTSIZE}]{article}
-$fontencString
\\renewcommand{\\tt}{\\rm}
\\usepackage[$babellanguage]{babel}
-\\usepackage[$inputcharset]{inputenc}
+\\usepackage{fontspec}
+\\directlua{
+ luaotfload.add_fallback(\"UniversalMailChain\", {
+ \"DejaVuSansMono.ttf:mode=node;\",
+ \"NotoSansCJKJP:mode=node;script=jpan\",
+ \"NotoSansDevanagari:mode=node;\",
+ \"NotoSansTamil:mode=node;\",
+ \"NotoSansArabic:mode=node;\"
+})}
+\\setmonofont{JuliaMono}[Renderer=HarfBuzz,RawFeature={fallback=UniversalMailChain}]
+\\setmainfont{DejaVu Sans}[Renderer=HarfBuzz,RawFeature={fallback=UniversalMailChain}]
+
\\usepackage{$LatexPackages}
\\usepackage[${paperformat}paper,left=$Config{LEFTMARGIN}mm,right=$Config{RIGHTMARGIN}mm,%
top=$Config{TOPMARGIN}mm,bottom=$Config{BOTTOMMARGIN}mm,headsep=5mm]{geometry}
\\usepackage{fancyvrb,graphicx,marvosym,textcomp,array}
+
+\\fvset{fontfamily=tt, breaklines=true}
+
$sansserif
\\setlength{\\parindent}{0mm}
$isolatinextensions
@@ -1434,7 +1448,7 @@
\\begin{document}
\\thispagestyle{plain}",
$BeforeHeader,
-"\\parbox{\\parboxwidth}{{\\large
+"\\parbox{\\parboxwidth}{{\\fontsize{11.5pt}{14pt}\\selectfont
\\begin{tabular}[t]{\@{}r>{\\raggedright}p{$PengTab}\@{}p{0mm}\@{}}";
output \*LATEX, @PrintedMailheaders;
--76i73lsczot7nqay--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads