[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] Type1 loader overwrites FontInfo dict with private dict
From: |
Ron . Dev |
Subject: |
[Devel] Type1 loader overwrites FontInfo dict with private dict |
Date: |
Wed, 28 May 2003 03:09:15 +0200 (CEST) |
Hello,
I found a rather tricky problem in t1load.c. There are several synthetic
fonts around that use a common private dict, but redefine the public
FontInfo dict for different variants (regular vs. oblique vs. italic).
The FreeType Type1 loader first parses the public dict then the private dict.
So in theory all values that occur twice get overwritten with the info from
the private dict (which is the wrong choice for synthetic fonts!).
There are several callback handlers that take care of that problem
(e.g. /FontMatrix, look for "with synthetic fonts ..."). But all plain
values (e.g. /ItalicAngle) *are* overwritten with the wrong values!
A particularly prominent example is Adobe's Helvetica vs. Helvetica-Oblique
(search for "HV______.PFB" and "HVO_____.PFB"). Obviously Helvetica-Oblique
has to have a different FontMatrix so you get a different display. And
parse_font_matrix() takes care of that case. So far so good ...
But ItalicAngle is overwritten, so face->type1.font_info.italic_angle
is zero for Helvetica-Oblique. This also means that T1_Face_Init does
not set FT_STYLE_FLAG_ITALIC in face->style_flags.
And this has very odd consequences with fc-cache (from fontconfig.org).
The cache file now has two entries with "slant=0":
"HVO_____.PFB" 0 "Helvetica:style=Oblique:slant=0:weight=100:index=0:...
"HV______.PFB" 0 "Helvetica:style=Regular:slant=0:weight=100:index=0:...
So Xft happily takes whichever font appears first in the cache file when
searching for family Helvetica with a slant of 0. If you are unlucky
most of your applications use the oblique font to display their menus
and other stuff. And this aint pretty!
It seems this problem has been reported in many other application specific
forums (Opera, OpenOffice.org, Qt, KDE, Gnome ...). Many people complain
that they get only italic or only bold fonts. However nobody tracked down
the real cause for this behaviour ...
Ok ... long explanation, but sorry ... no patch! I simply don't know how
to fix this without major changes to the code. Either the private dict has
to be loaded before the public dict (but what about multiple masters?).
Or a special check in t1_load_keyword? Or a generic check if any keyword
appears twice?
I hope that someone more knowledgeable about the internals of the Type1
loader finds a good fix for this problem.
|Ron|
- [Devel] Type1 loader overwrites FontInfo dict with private dict,
Ron . Dev <=