xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Hennebert" <vhenneb...@gmail.com>
Subject Re: Implementing OpenType font support, how hard?
Date Wed, 02 Aug 2006 16:44:28 GMT
Hi Bertrand,

As I've made some work in this area, I can provide a few additional
hints. In fact I'm kind of a "bridge" between FOray and Fop and am
working on adapting FOrayFont to Fop. Currently I'm not doing much
because I'm busy with some other work on Fop for the Google Summer of
Code, but I should have some time again to work on this from
mid-september on (mmmh, is it too late for you?).

> > 2d) Re-enable kerning, as OpenType fonts are usually of high quality
> > and "deserve" to be used with automatic kerning.
> Ok, that should be obsolete.
> One point about 2) is that Vincent Hennebert and Victor Mote are working
> on FOrayFont to create a better font library which we'd like to use when
> it's finished. So this may mean that some of this work would better be
> done in/for ForayFont. Finishing 2) would then also mean finishing
> FOrayFont to the degree that it can be used in FOP. I guess that will
> need further deliberation.

(Some quick background on this: I submitted a patch in december 2005
which integrated FOrayFont into Fop; it was not applied because of too
severe limitations of FOrayFont. I'm currently working on implementing
the missing features; there are still two of them to implement, and then
the adaptation may be restarted. Of course the Fop code has quite
evolved since december.)

I believe there is basic OpenType support in FOrayFont, I can't say more
without having a deeper look. AFAICT there are two areas of work:
* complete the parsing of OpenType font files;
* make sure the API provides access to the most advanced features of
  OpenType fonts.

The FOray project:
You may be interested in subscribing to the foray-dev list.

> > 3) Additional steps for OpenType GSUB table support
> > The goal is to enable the "smart font" features of OpenType, automatic
> > ligatures as mentioned above, language-dependent glyph substitutions
> > (different shapes if a letter is at the beginning of a word for
> > example), automatic decorative swashes at the beginning or end of
> > words, etc.
> >
> > 3a) Decode the GSUB table of the OpenType font (and other tables that
> > might be required to use it) and store its data in the FOP XML font
> > metrics file
> One goal of FOrayFont is to make the separate metrics file obsolete. The
> font files will be interpreted directly. This should also simplify the
> whole system, especially for the user.
> > 3b) Modify the chars-to-metrics mapping to handle things like
> > automatic ligatures, where several chars map to a single glyph
> Here I think you can profit from my work on kerning to handle special
> cases.

The only problem I see with ligatures is when a word may be hyphenated
between two characters for which there is a ligature: if it ends up
being hyphenated the separate glyphs should be used, otherwise the
ligature glyph should be used. I don't think this can be easily
represented in the current Knuth glue/box/penalty model which is used to
break lines into paragraphs.
I also believe that in German (and perhaps other languages), ligatures
are not welcome in some compound words.
And I wonder if the ligature mechanism is similar for non-western
languages which heavily use them (Arabic, for example).

> > 3c) Implement GSUB table handling, glyph substitutions (or reuse an
> > existing library for this, but the only one that I've found is
> > freetype, haven't found one in Java).
> >
> > 3d) Create test documents to demonstrate this, asking a font provider
> > for a donation of some OpenType fonts to use in FOP tests.
> That's one possibility. Another one might be the DejaVu fonts which we
> have found after a LOT of searching for a font with an ASF-compatible
> license. However, I haven't received any official feedback on license
> compatibility, yet. OTOH, I'm not sure if those fonts will enable you to
> show off all the features you want to implement.

Aren't DejaVu fonts only TrueType fonts?

> > Even this wouldn't be complete, as OpenType allows specific features
> > to be enabled for specific character runs, like "use alternate glyph
> > set 2 for this character only". But it would be a good start already
> > ;-)
> :-) Sure.
> > At this point I'm mostly interested in your opinion on points 1) and
> > 2) above, if these enhancements seem realistic I might be able to work
> > on them in my current project. Point 3) obviously needs more work and
> > might not fit my budget at this point.
> In general, I'm happy if we get some reinforcements on the font front.
> 2) shouldn't be a very big task. But I assume the whole FOrayFont thing
> might make this a little more complicated.
> AFAIK, OpenType allows different variants of a font in one font file
> (ex. normal and bold). We've had requests to support those font files.
> Have you found out during your investigations what would be involved in
> supporting this and would this be in scope for your work? So far, I've
> been unable to find out how this is handled.
> > Thanks for any feedback on this!
> > -Bertrand
> >
> > [1] http://xmlgraphics.apache.org/fop/0.20.5/fonts.html#embedding
> > [2] http://www.underware.nl/site2/index.php3?id1=bello&id2=testbello

I'll be happy to help wherever I can, as this whole area is of interest
for me.


View raw message