Bug 75444 - fc-cache doesn't understand font encodings for many .pcf files
Summary: fc-cache doesn't understand font encodings for many .pcf files
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: fontconfig
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Owen Taylor
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-10-08 17:45 UTC by Eric Hopper
Modified: 2008-05-01 15:38 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-10-08 22:02:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Eric Hopper 2002-10-08 17:45:57 UTC
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:
Always

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 17:51:14 UTC
I initially filed this bug:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=75436

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 20:39:06 UTC
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 21:01:12 UTC
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 22:02:16 UTC
Fixed the problem.

First:

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:

#!/usr/bin/python

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
        a.flush()

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

--------------------

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 22:27:41 UTC
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 16:54:14 UTC
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
well.

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.