Re: Pango Status Report, 9 Feb 2000

Steve Underwood <> writes:

> Owen Taylor wrote:
> > Recent progress:
> >
> >  In the last few weeks, I've been concentrating my efforts
> >  on the font system, both for the rendering-independent
> >  interfaces and for X.
> >
> >  The general design for the font independent stuff is pretty
> >  similar to lots of existing systems ... whether Java or
> >  gnome-font. The exact set of properties is based most
> >  closely on the font properties from CSS2.
> >
> >  You can check out the API for this at:
> >
> >
> >
> >  The X work I've done is mostly implementing this API for the X
> >  platform, and also improving the selection algorithms for finding
> >  XLFDs to match a particular PangoFontDescription and size. (I'm now
> >  just listing all fonts from the X server with XListFonts() and
> >  doing all the matching client side.)
> >
> >  The other thing I've been working on is getting fonts to report
> >  their own coverage maps. This will allow better handling of
> >  selecting fonts with fallbacks to other fonts for character
> >  points not handled by the first font.
> >
> >  The implementation of this is pretty much complete, though it isn't
> >  yet used by the shaping core.
> How do you plan to do the fallback? Will you require a list of fallback fonts to
> be defined by the application, or do you aim to have some automated approach, by
> scanning available fonts? Pango 0.6 doesn't yet handle the fallback, and so it
> gives pretty crazy results if I select anything but unifont. I can't see the
> direction in which things are going, though. If I try to pick, say, the fixed
> font, where I have GB, JIS, and Big5 fonts called fixed, Pango doesn't need to
> fallback. It just needs to check all the fonts called fixed, to find one with an
> available glyph. I can't see your strategy for handling this, though. Right now
> it seems to simply reject the characters not covered by the first font it tries.
> Am I missing something?

The thing to realize is that there are actually two levels of 
font-switching / fallback in the design.

The lower level (which is pretty much completely implemented at this point),
is inside the X rendering portion of Pango and is meant primarily to
disguise the X font system as something reasonable. The way this works
is that the X incarnation of PangoFont is a fontset - a list of XLFDs
with wildcards for the size and character set. When the shaping engine
wants a character from a particular encoding, it queries libpangox,
and libpangox finds the best matching X font for that character.

These fontsets are derived in two ways - either they are derived from
implicitely merging X fonts with the same family name, or they are
derived by listing in an alias file. The latter mechanism is used
to define a number of standard system aliases - Sans, Serif, Monospace,
etc, that are guaranteed to always be present and well-adapted to
the fonts installed on the systme.

This level is basically is invisible to the user and application
writer. They simply see that they have "Helvetica", "Times", "Sans",
etc, available to them, and don't have to worry about the fact that they
have 18 variants of each of these fonts in different bitmap sizes, 
character sets, etc. These fonts, however, don't necessarily have complete
coverage, though the standard aliases (Sans, etc) should be designed to
be as complete as possible.

The upper level consists of an ability to specify lists of fonts 
to be applied to a particular piece of text; Pango then chooses
the font that covers the characters of the text best. This is
the real "fallback" mechanism of Pango. An application that wanted
to specify the font for a dialog box could specify:


instead of simply "Utopia", and they could be pretty sure of getting
good results for a range of languages, even if Utopia is only present
for a few encodings. 

This second level of fallback isn't fully implemented yet - I hope
to do it tomorrow. In my current design, there is no provision
for standard fallbacks - the assumption is that dialog designers,
and other people who don't know what is available on the system
will put a standard alias at the end of their font lists, and
that user's selecting fonts directly will rather pick a font
that works for their language than rely on fallbacks.

It would be possible, however, to always do an implicit fallback in
the case where no match is found. That is, to implicitely tack
"Serif" on to the end of every font set. Right now, Pango omits
those characters. (It tries to display the "unknown character" glyph,
but unfortunately most X fonts don't have one of these, so the 
characters just silently disappear - it will probably be necessary
to actual draw in a rectangle ourselves in the future to prevent

There is more information about the design of both levels in the two
documents under "Design" on


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]