Around 13 o'clock on Feb 20, Erik van der Poel wrote:

> I tried to follow the CSS2 spec as closely as possible, especially on X,
> where I checked the font properties in the order specified in CSS2. On
> Windows, I let the OS do a lot of the matching, and it may not have
> followed the CSS2 order exactly, but the results looked OK.

That's what the current Xft/fontconfig patch for Mozilla does, and the
results do look OK; that patch can be found at

   http://keithp.com/~keithp/download/mozilla-keithp-2002-02-19-1955.diff

Fixing fontconfig to support more of the CSS2 matching algorithm means 
that the patch for Mozilla will remain small while improving it's 
conformance.

> so as long as the new font APIs include some low-level ones that allow apps
> to do their own matching (non-CSS if they wish), then it doesn't really
> matter that fontconfig happens to have chosen to follow CSS2.

Yes, the complete catalog of fonts is always available from fontconfig and 
the font listing API provides a convenient mechanism for searching it 
based on precise characteristics.

> CSS2 specifies that the implementation must behave as though it looks at
> each character. I suppose fontconfig could do that using an FcCharSet with
> only one member :-)

The mozilla patch does essentially that, with the inaccurate optimization 
of looking first at already loaded fonts.  Fixing that is relatively 
straightforward, but I'd rather get the matching fixed first as I think 
that will have an impact on the correct selection mechanism.

> but CSS3 seems to have backed off from the per-character spec, choosing
> instead to go with per-textual-element, which is probably more sensible.

That requires access to the document data, something Xft and Fontconfig
don't have. 

I can use either mechanism at the application level given the ability to
quickly select fonts based on Unicode coverage.  I am considering adding
per-character matching and font substitution as an option at the Xft API
level so that simple minded applications can get the broadest Unicode
coverage available without requiring significant work.

> Your scheme seems to use the order charset, family, size, slant, weight,
> while CSS2 specifies the order character, family, style, weight, size.
> Also, your scheme measures the "distance" between a pattern and a font,
> while CSS2 specifies that e.g. font-style must be matched exactly. Minor
> nits?

The 'distance' metric is used to pick similar styles -- just as CSS2 
allows the substitution of 'oblique' for 'italic' and weight-fill in.
They are also used to select among several available bitmap font sizes.

These are the 'gratuitous' differences of which I speak; there's no
good reason for Fontconfig to differ in these minor ways from CSS2;
simply adopting CSS2 would be straightforward given the current 
infrastructure, and wouldn't materially affect existing Xft-based 
applications.

> Well, I can certainly see your point, but the question is, how far do
> you want to take this? Do you want to implement CSS2 exactly? In that
> case, you may want to use the CSS2 syntax.

The syntax isn't particularily relevant; Fontconfig already accepts two 
different representations for font names -- both XLFD and the new 
Fontconfig-specific syntax.  Adding CSS2 wouldn't be a big step, but I'm 
not sure of the value -- internally, Fontconfig holds names as a set of 
properties each with a list of values.  In addition, there are parts of 
CSS2 and CSS3 which can only be handled at the application level, like the 
interpretation of 'bolder'.

> Does fontconfig also allow the user to override the author (i.e. app)?

Yes, the user configuration file can perform arbitrary substitutions within
the pattern.  I have my environment configured to always replace 'Times'
fonts with 'Times New Roman' because the look is similar, but the
extensively hinted TT Times New Roman faces are significantly easier to
read than the Type1 Times.

Parts of CSS2 compliance will require correct configuration file 
structure; I'd prefer to retain the current flexibility so that portions 
of CSS2 in conflict with the users desires can be overridden.

Keith Packard        XFree86 Core Team        Compaq Cambridge Research Lab


_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts

Reply via email to