[Fontconfig] Re: freetype internals

Mike FABIAN mfabian at suse.de
Fri Dec 9 07:29:05 PST 2005


Matthias Clasen <mclasen at redhat.com> さんは書きました:

> Another worthwhile goal for fontconfig 2.4 would be to get rid of the
> use of freetype internal headers in fcfreetype.c, since those headers
> will go away with freetype 2.2.
>
> I have attached a patch to accomplish this to 
>
> https://bugs.freedesktop.org/show_bug.cgi?id=4779

The following part of this patch causes a problem:

@@ -1560,6 +1552,7 @@ FcFreeTypeQuery (const FcChar8	*file,
     }
 #endif
 
+#if 0
     /*
      * Skip over PCF fonts that have no encoded characters; they're
      * usually just Unicode fonts transcoded to some legacy encoding
@@ -1569,6 +1562,7 @@ FcFreeTypeQuery (const FcChar8	*file,
 	if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf"))
 	    goto bail2;
     }
+#endif

As the comment says, many bitmap fonts may be available in in Unicode
and transcoded to legacy versions. Many such fonts are already
distributed with X-org. Another example are the terminus fonts.
Before the above change, fontconfig listed only the Latin1 and unicode
versions of such fonts:

mfabian at baker:~$ fc-list "xos4 terminus:style=Regular:pixelsize=16" file
/usr/X11R6/lib/X11/fonts/misc/ter-116n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-x16n.pcf.gz:
mfabian at baker:~$

Which is good because all the other recoded versions are not supported
anyway. After the above change, all recoded versions are listed as
well:

mfabian at magellan:~$ fc-list "xos4 terminus:style=Regular:pixelsize=16" file
/usr/X11R6/lib/X11/fonts/misc/ter-c16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-k16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-g16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-116n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-p16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-u16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-f16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-916n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-x16n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-516n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-216n.pcf.gz:
/usr/X11R6/lib/X11/fonts/misc/ter-d16n.pcf.gz:
mfabian at magellan:~$

Now it can easily happen that one of the recoded version matches:

mfabian at magellan:~$ fc-match "xos4 terminus:style=Regular:pixelsize=16"
ter-216n.pcf.gz: "xos4 Terminus" "Regular"
mfabian at magellan:~$

This fonts are not supported and have not encoded characters, i.e. the
"charset=" and "lang=" fields in the fonts.cache-2 files are empty:

mfabian at magellan:~$ fc-cat /usr/X11R6/lib/X11/fonts/misc/fonts.cache-2 | grep ter-216n.pcf.gz
"ter-216n.pcf.gz" 0 "xos4 Terminus-16:style=Regular:slant=0:weight=80:width=100:pixelsize=16:spacing=110:foundry=xos4:antialias=False:index=0:outline=False:scalable=False:dpi=72:charset=:lang=:fontversion=0:fontformat=PCF"
mfabian at magellan:~$

And for such non-supported fonts, only replacement characters are
displayed in most programs (e.g. xfd, xterm, ...)  and some programs
even crash (urxvt).

I wonder why in the original code the skipping of fonts which have no
encoded characters was limited to PCF fonts. Even if it is not a PCF
font, if it has no encoded characters, it is completely useless, isn't
it? If yes, the easiest way to fix the problem would be to use the
attached patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitmap-encoding-problem.patch
Type: text/x-patch
Size: 838 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051209/02c3de66/bitmap-encoding-problem.bin
-------------- next part --------------

-- 
Mike FABIAN   <mfabian at suse.de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。


More information about the Fontconfig mailing list