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 Matthias
Matthias Clasen <mclasen@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=4779The 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@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@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@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@magellan:~$ Now it can easily happen that one of the recoded version matches: mfabian@magellan:~$ fc-match "xos4 terminus:style=Regular:pixelsize=16" ter-216n.pcf.gz: "xos4 Terminus" "Regular" mfabian@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@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@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@suse.de> http://www.suse.de/~mfabian ?????????????
On Fri, 2005-12-09 at 16:29 +0100, Mike FABIAN wrote:> I wonder why in the original code the skipping of fonts which have no > encoded characters was limited to PCF fonts.Symbol fonts, and others with encodings known to custom applications. -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051209/77012b5e/attachment.pgp
Keith Packard <keithp@keithp.com> ????????:> On Fri, 2005-12-09 at 16:29 +0100, Mike FABIAN wrote: > >> I wonder why in the original code the skipping of fonts which have no >> encoded characters was limited to PCF fonts. > > Symbol fonts, and others with encodings known to custom applications.Shortly after I wrote my last mail I also thought about symbol fonts and thought that they would probably be skipped as well with my patch. But strangely enough they are still listed by fc-list and can still be used: mfabian@magellan:~$ fc-list : family foundry style | grep -i symbol OpenSymbol:style=Regular:foundry=unknown Standard Symbols L:style=Regular:foundry=urw Symbol:style=Regular:foundry=adobe SeanSymbols:style=Regular:foundry=unknown mfabian@magellan:~$ I don''t understand why though. Probably it is safer to skip only for PCF fonts like the old code did but do it without using freetype internals. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
On Sat, 2005-12-10 at 01:38 +0100, Mike FABIAN wrote:> Shortly after I wrote my last mail I also thought about symbol > fonts and thought that they would probably be skipped as well with > my patch. But strangely enough they are still listed by fc-list > and can still be used:Yeah, I wouldn''t be surprised if Adobe symbol fonts provided Unicode mappings for their glyphs. I''m sure there are other custom fonts which don''t though, like maybe the LaTeX math fonts. I just don''t want to skip legit fonts, I only want to skip bogus bitmaps. Perhaps we can just use the presense of some BDF properties to detect BDF-derived non-Unicode bitmap fonts? -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051209/bb6ad2b7/attachment.pgp
Keith Packard <keithp@keithp.com> ????????:> On Sat, 2005-12-10 at 01:38 +0100, Mike FABIAN wrote: > >> Shortly after I wrote my last mail I also thought about symbol >> fonts and thought that they would probably be skipped as well with >> my patch. But strangely enough they are still listed by fc-list >> and can still be used: > > Yeah, I wouldn''t be surprised if Adobe symbol fonts provided Unicode > mappings for their glyphs. I''m sure there are other custom fonts which > don''t though, like maybe the LaTeX math fonts. I just don''t want to skip > legit fonts, I only want to skip bogus bitmaps. > > Perhaps we can just use the presense of some BDF properties to detect > BDF-derived non-Unicode bitmap fonts?How to do that? I guess something like the original test for pcf fonts without using freetype internals is not possible. Or is it? -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????
Keith Packard wrote:> Yeah, I wouldn''t be surprised if Adobe symbol fonts provided Unicode > mappings for their glyphs. I''m sure there are other custom fonts which > don''t though, like maybe the LaTeX math fonts. I just don''t want to skip > legit fonts, I only want to skip bogus bitmaps. > > Perhaps we can just use the presense of some BDF properties to detect > BDF-derived non-Unicode bitmap fonts?Is this perhaps what we want? Do all fonts have to have PIXELSIZE? I couldn''t find any way to enumerate all BDF props. pat Index: src/fcfreetype.c ==================================================================RCS file: /cvs/fontconfig/fontconfig/src/fcfreetype.c,v retrieving revision 1.60.2.10 diff -u -p -r1.60.2.10 fcfreetype.c --- src/fcfreetype.c 19 Nov 2005 22:32:13 -0000 1.60.2.10 +++ src/fcfreetype.c 20 Dec 2005 17:01:33 -0000 @@ -1555,17 +1555,20 @@ 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 + * ftglue.c forces us to approximate whether a font is a PCF font + * or not by whether it has any BDF properties. Try PIXELSIZE; + * I don''t know how to get a list of BDF properties on the font. -PL */ if (FcCharSetCount (cs) == 0) { - if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf")) +#if HAVE_FT_GET_BDF_PROPERTY + if(FT_Get_BDF_Property(face, "PIXELSIZE", &prop) == 0) goto bail2; - } #endif + } if (!FcPatternAddCharSet (pat, FC_CHARSET, cs)) goto bail2;
On Tue, 2005-12-20 at 12:07 -0500, Patrick Lam wrote:> Is this perhaps what we want? Do all fonts have to have PIXELSIZE? I > couldn''t find any way to enumerate all BDF props.All BDF fonts should have PIXEL_SIZE. This will have the side effect of catching SFNT encapsulated former-BDF fonts which will also report the presense of BDF properties. I think that''s OK though; I don''t know of any BDF fonts which aren''t either delivered in Unicode or Adobe Symbol (which fontconfig can transcode to Unicode). -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051220/4ad97d8a/attachment.pgp
Patrick Lam <plam@MIT.EDU> ????????:> Keith Packard wrote: >> Yeah, I wouldn''t be surprised if Adobe symbol fonts provided Unicode >> mappings for their glyphs. I''m sure there are other custom fonts which >> don''t though, like maybe the LaTeX math fonts. I just don''t want to skip >> legit fonts, I only want to skip bogus bitmaps. >> >> Perhaps we can just use the presense of some BDF properties to detect >> BDF-derived non-Unicode bitmap fonts? > > Is this perhaps what we want? Do all fonts have to have PIXELSIZE? I > couldn''t find any way to enumerate all BDF props.Seems to work fine, thank you. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ?????????????