[Fontconfig] Mozilla, Xft and (buggy?) fonts
Anthony Fok
anthony at thizlinux.com
Fri Feb 14 16:14:32 EST 2003
Hello Keith,
On Tue, Feb 11, 2003 at 11:04:26AM -0800, Keith Packard wrote:
> > A visual check with ftview showed that the glyph indices are off by 26
>
> I have a vague recollection of having fixed a bug like this. Can you
> report which versions of the X server, Xrender, Xft and fontconfig you are
> using?
It turns out that it was the font itself afterall. I finally got to
FcFreeTypeCharIndex(), and added some printf's in there. It turns out
that:
* Before the copyright sign: FT_ENCODING_UNICODE, all is fine.
* At the copyright sign: got switched to FT_ENCODING_APPLE_ROMAN
* After the Copyright Sign, all the text are still in the ASCII
range, so FcFreeTypeCharIndex() stayed with FT_ENCODING_APPLE_ROMAN.
Unfortunately, this font's CMap Format 0 AppleRoman is all wrong:
U+0006 got mapped to space (rather than U+0020), and similarly,
everything else is off by the same amount. 0x20 - 0x6 = 0x1A = 26.
That explains it.
No wonder I couldn't reproduce this problem with any other fonts. But
I am glad that this is no bug of fontconfig/Xft afterall. :-)
Oh, speaking of which, I have a patch for you to change "ft_encoding_*"
to their uppercase equivalent. Please apply it as appropriate (unless
you need to maintain compatibility with FreeType 2.0.x.)
Cheers,
Anthony
--
Anthony Fok Tung-Ling
ThizLinux Laboratory <anthony at thizlinux.com> http://www.thizlinux.com/
Debian Chinese Project <foka at debian.org> http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp! http://www.olvc.ab.ca/
-------------- next part --------------
--- fontconfig-2.1.orig/src/fcfreetype.c
+++ fontconfig-2.1/src/fcfreetype.c
@@ -345,7 +345,7 @@
/*
* Convert AppleRoman to Utf8
*/
- map = FcFreeTypeGetPrivateMap (ft_encoding_apple_roman);
+ map = FcFreeTypeGetPrivateMap (FT_ENCODING_APPLE_ROMAN);
if (!map)
continue;
--- fontconfig-2.1.orig/src/fccharset.c
+++ fontconfig-2.1/src/fccharset.c
@@ -1642,9 +1642,9 @@
};
static const FcFontDecode fcFontDecoders[] = {
- { ft_encoding_unicode, 0, (1 << 21) - 1 },
- { ft_encoding_symbol, &AdobeSymbol, (1 << 16) - 1 },
- { ft_encoding_apple_roman, &AppleRoman, (1 << 16) - 1 },
+ { FT_ENCODING_UNICODE, 0, (1 << 21) - 1 },
+ { FT_ENCODING_MS_SYMBOL, &AdobeSymbol, (1 << 16) - 1 },
+ { FT_ENCODING_APPLE_ROMAN, &AppleRoman, (1 << 16) - 1 },
};
#define NUM_DECODE (sizeof (fcFontDecoders) / sizeof (fcFontDecoders[0]))
More information about the Fontconfig
mailing list