public inbox for printing-users@lists.linux.dev
 help / color / mirror / Atom feed
From: Matthias Apitz <guru@unixarea.de>
To: printing-users@lists.linux.dev
Subject: Fwd: [cups] An issue with fonts in freefont-otf-20120503.tar.gz
Date: Fri, 30 May 2025 11:19:57 +0200	[thread overview]
Message-ID: <aDl4PaS2pcJEqalO@pureos> (raw)

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


-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

                 reply	other threads:[~2025-05-30  9:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aDl4PaS2pcJEqalO@pureos \
    --to=guru@unixarea.de \
    --cc=printing-users@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox