On May 11, 2008, at 11:01, [EMAIL PROTECTED] wrote:

Hi Max

Author: maxberger
Date: Sun May 11 02:01:31 2008
New Revision: 655281

URL: http://svn.apache.org/viewvc?rev=655281&view=rev
Support character-by-character font-selection strategy on fo:character element

Good thinking!
FWIW, I've also been thinking in a similar direction, but maybe a bit more generic, as utility method in the FontManager maybe (?)

     /** [EMAIL PROTECTED] */
     public void initialize() {
-        Character fobj = (Character)this.fobj;
-        FontInfo fi = fobj.getFOEventHandler().getFontInfo();
- FontTriplet[] fontkeys = fobj.getCommonFont().getFontState (fi); - font = fi.getFontInstance(fontkeys[0], fobj.getCommonFont ().fontSize.getValue(this));

The piece of code that you moved to a separate method here here was indeed a temporary solution of my moving this logic out of the FO tree, since I feel it did not really belong there. I just needed to get the same behavior as before, when it was housed in CommonFont, which always returned the first font-family in the list.

+    private Font selectFontForCharacter(Character fobj) {

Now that we have a FontManager, what if we add something to it like:

public Font selectFontForCharacter(FontTriplet[] triplets, char, int)

That way the loop in question finally moves to where I think it actually belongs... and a similar approach could then be applied to the TextLayoutManager. As an initial step, we could already make sure that the selected font is always one that can display the first character.

Just my 2 cents.



Reply via email to