Bug 75444 - fc-cache doesn't understand font encodings for many .pcf files
fc-cache doesn't understand font encodings for many .pcf files
Product: Red Hat Linux
Classification: Retired
Component: fontconfig (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Owen Taylor
Depends On:
  Show dependency treegraph
Reported: 2002-10-08 13:45 EDT by Eric Hopper
Modified: 2008-05-01 11:38 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-10-08 18:02:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Hopper 2002-10-08 13:45:57 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
fc-cache doesn't create entries in fonts.cache-1 for all .pcf files in the
directory.  It also doesn't give any error messages saying why this is.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.mkdir ~/.fonts
2.cd ~/.fonts
3.gunzip -c /usr/X11R6/lib/X11/fonts/misc/clB6x10.pcf.gz > clB6x10.pcf
4.fc-cache -v

Actual Results:  An empty fonts-cache.1 file in ~/.fonts

Expected Results:  A fonts-cache.1 file describing the 6x10 bold font in the
Clean family that's in clB6x10.pcf

Additional info:
Comment 1 Eric Hopper 2002-10-08 13:51:14 EDT
I initially filed this bug:

Then I learned about the new font system, and tried to get the schumacher-clean
fonts in the manner suggested, and came across this problem.
Comment 2 Eric Hopper 2002-10-08 16:39:06 EDT
It's skipping them because of this bit of code at fontconfig/src/fcfreetype.c:519:

     * Skip over PCF fonts that have no encoded characters; they're
     * usually just Unicode fonts transcoded to some legacy encoding
    if (FcCharSetCount (cs) == 0)
	if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf"))
	    goto bail2;
Comment 3 Eric Hopper 2002-10-08 17:01:12 EDT
This happens because it doesn't understand the encoding ISO646.1991-IRV.  I
think ISO646 is straight 7 bit ASCII.  If I comment out that test, I end up with
a font that has no glyphs.

The X server and xfs understand this encoding, so I don't know why fc-cache
doesn't seem to be able to.
Comment 4 Eric Hopper 2002-10-08 18:02:16 EDT
Fixed the problem.


mkdir ~/.fonts
cd /usr/X11R6/lib/X11/fonts/misc
for file in cl*; do gunzip -c "$file" >~/.fonts/I"${file%.gz}"; done
cd ~/.fonts

Then I ran this python script:


import mmap
import os

def fixfile(fname):
    f = open(fname, 'r+')
    a = mmap.mmap(f.fileno(), os.fstat(f.fileno())[6], access = mmap.ACCESS_WRITE)
    i = a.find('CHARSET_REGISTRY\0ISO646.1991\0CHARSET_ENCODING\0IRV\0')
    replace = 'CHARSET_REGISTRY\0ISO8859\0\0\0\0\0CHARSET_ENCODING\0001\0\0\0'
    if i != -1:
        a[i:i+len(replace)] = replace

flist = os.listdir()
for fname in flist:
    if fname[0] = 'I':


Then I ran fc-cache.  It create a nice fonts.cache-1 file for me in which all of
the .pcf files have a reasonable correct entry.

fc-cache still should more reasonably handle the ISO646.1991-IRV registry, and
any other weird registry that might show up in a .pcf file.
Comment 5 Owen Taylor 2002-10-31 17:27:41 EST
The problem is that to handle most of the interesting encodings
requires a whole recoding framework, which isn't a direction
that Keith Packard is interested in for fontconfig.

The general direction that people are discussing is getting
rid of .pcf files for storing bitmap fonts and using bitmaps
stored TrueType font file format instead.
Comment 6 Eric Hopper 2002-11-01 11:54:14 EST
This sounds wonderful, but there then needs to be some sort of conversion
utility to convert old pcf fonts to TrueType bitmap fonts.  The recoding
framework will be nicely isolated there, but it needs to be there.

I can't live without the schumacher-clean family.  At least, not until 3200x2400
displays are standard so I can get tiny text that has enough dots to be rendered

Of course, my ugly hack handles the schumacher-clean family well.  So my
personal irritation is gone.

Note You need to log in before you can comment on or make changes to this bug.