RE: [FOray-developer] fonts and AWT renderer
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
From: Victor M. <vi...@ou...> - 2005-09-20 18:31:03
|
Vincent Hennebert wrote: > [Depending on the answer to this message, this may better go > in foray-support] > > I have a problem with Fop's AWT renderer that gets broken > when converted to use > FOrayFont: the same font is used for displaying the text, > whatever I specify in the fo file (serif/sans-serif, > normal/bold, etc.). > > When I want to specify a font to use by the AWT renderer I > call the method getAWTFont, that works for system fonts but > not for free-standing fonts. So for those latter I manually > create an AWT font but then I'm missing style information > (normal/bold) and family information (serif/sans-serif get > converted into times/helvetica). For the family I can do a > switch on the font name, to re-map common names like times > and helvetica to Serif, sansSerif, etc. But I'm still missing > style information. I am not sure I understanding everything here. Basically, you should not try to use free-standing fonts with the AWT renderer. And creating your own AWT fonts defeats the purpose of using the user's font-configuration file. > So, first question: how do I specify that system fonts should > be used? Directly in the fo file or in the font config file? It is conceivable that one could use a separate style sheet to handle the this kind of issue, but FOray should be able to handle it without changes to the fo file. I have just added some doc on troubleshooting this kind of issue, here: http://www.foray.org/module/font/index.html#system-fonts The doc may not be complete, but should get us started on finding your problem. > Second question: I think even free-standing fonts should be > able to return a corresponding AWT Font, by using the > java.awt.Font.createFont method of the standard lib. I > believe it is possible for TrueType fonts in Java 1.4 and > also for Type1 fonts in Java 5. You may have heard me discuss this on the fop-dev website recently. We are very close to being able to try this. A lot of the changes to the font-configuration have been made with this capability in mind. It is non-trivial, and basically means that the font system must maintain both a SystemFont and a FreeStandingFont instance and keep them married. When you have some time to help test this, I'll be glad to work on it with you. Peter West also needs this, and he may beat you to it. > A question follows: how to get font infos for the Base14 > fonts? There's no pfb file available for them. Perhaps they > should be mapped to the corresponding system fonts provided > with Java (the Lucida family); but the metrics may be > different, though. This question is still open for me. The metrics for the Base-14 fonts, when used as FreeStandingFonts, come from the AFM files that are in the repository. If you set those up with the system-name attribute pointing to the Lucida system fonts, you should get the Lucida fonts if everything else is set up correctly. Keep in mind that the <font-family> element is what needs to match the fo file. The child <font-description> element then points to a <font> element, which can be used either as a free-standing font or a system-font (if system-name is defined), or (eventually) both. So keep that path in mind as you debug this. It is quite possible that there is a bug or two in all of this as well. While you check the things mentioned above, I'll do some testing. Victor Mote |