An issue with fonts in freefont-otf-20120503.tar.gz
Hello,
I'm a long term CUPS user, since CUPS 1.4.3, 2010, because we use CUPS to print UTF-8 text files out of a Library Management System, produced by the company I'm working for and installed at 100++ customer sites. The CUPS mailing list seems to be somewhat closed and I was directed to this list with my problem.
We're printing UTF-8 to PDF with a component 'texttopf' of CUPS 2.3.6, on Linux and a bit simplified the CUPS server issues a command like this for the UTF-8 files to print to PDF:
CHARSET=utf-8 /usr/local/sisis-pap/cups2/lib/cups/filter/texttopdf 1 1 1 1 1 CUPS-UTF8.txt > /tmp/out.pdf
texttopdf is part of cups-filters-1.0.62 (in my case) and most of the language sets are printed fine, but the following India languages do not:
Bishnupriya Manipuri: ১৮শ বারো ১৯শ শতাব্দীর হমবুকে বিষ্ণুপ্র
Bengali: সমস্ত মানুষ স্বাধীনভাবে সমান মর্যাদা এবং অধিকার নিয়ে জন্মগ্রহণ করে। তাঁদের বিবেক এবং বুদ্ধি আছে; সুতরাং সকলেরই একে অপরের প্রতি ভ্রাতৃত্বসুলভ মনোভাব নিয়ে আচরণ করা উচিৎ।
The resulting PDF file can be seen here:
http://www.unixarea.de/freefont-otf-20120503-CUPS-UTF8.pdf
The problem originated from a very old GNU FreeFonts, from year 2010, and meanwhile I got access to the latest version from 2021, freefont-otf-20210506.tar.gz. The problem persists. I started digging into it and was told the Bengali is only supported in FreeSans, but not in FreeMono. But, texttopdf is unwilling to use FreeSans.
I simplified the test case to:
1)
the UTF-8 file to print has only one line for Bengali
2)
the file which maps code points to fontnames has only the line for Bengali:
0980 09FF ltor single FreeSans FreeSans:bold FreeSans:oblique FreeSans:bold:oblique
3)
I enabled the DEBUG statements in texttopdf.c
It turns out on STDERR, that texttopdf.c knows from the file with the fontnames that it *should* use FreeSans, but at the end the function load_font() in texttopdf.c (attached) selects FreeMono:
...
DEBUG: line: "0980 09FF ltor single FreeSans FreeSans:bold FreeSans:oblique FreeSans:bold:oblique "
DEBUG: num_fonts:0 lineptr: "FreeSans:bold FreeSans:oblique FreeSans:bold:oblique "
DEBUG: font_load() entry: "FreeSans"
DEBUG: font_load(): pattern: "^A"
DEBUG: font_load() selected font /usr/share/fonts/FreeFont/FreeMono.otf
DEBUG: num_fonts:0 lineptr: "FreeSans:oblique FreeSans:bold:oblique
"
DEBUG: k:0 valptr: "FreeSans:bold"
DEBUG: font_load() entry: "FreeSans:bold"
DEBUG: font_load(): pattern: "^B"
DEBUG: font_load() selected font /usr/share/fonts/FreeFont/FreeMonoBold.otf
...
I've no clue why font_load() selects the FreeMono.otf and not the FreeSans.otf.
A comment in the source says:
/* In the list of fonts returned by FcFontSort()
find the first one that is both in TrueType format and monospaced */
Maybe that's the reason...
Thanks
matthias
Signature · 2 lines
Matthias Apitz, ✉ [email protected], http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub