Hi Adrian You could just leave the font-weight and font-style matching on the side for now and only do font-family matching. That leaves you with exactly the same functionality you planned but with the option to extend the whole thing later. And I'm sure it's not significantly more work this way. Otherwise, we're just introducing a parallel mechanism later on because you restricted yourself to base 14 fonts.
How is backwards compatibility involved here? Could you elaborate on that? I'm not sure how you planned to implement your idea, so I'll shortly outline mine: FontInfo.lookupFont() is the main change area for my idea. Instead of just blindly generating a FontTriplet, the substitution list is consulted by looking up the font-family (I'd call that matching and the info for that comes from the "from" tag in my example). In your case you just implement font-family matching and leave font-weight and font-style matching to me for later. If you have a match you build the FontTriplet and replace the values specified on the "to" element in my example. With that FontTriplet you go normally into the font lookup process. Finally, this has to be tied into the PrintRendererConfiguration. I hope that makes sense. If you're more comfortable with your own approach I guess I can live with that. On 24.04.2008 12:09:38 Adrian Cumiskey wrote: > Hi Jeremias, > > Your suggested format does seem more flexible but implementing this would > expand the scope of the > job more than is necessary for me to implement this feature. Then there is > also the question of > backwards compatibility... (especially if the <font-triplet/> is scheme is > changed/superseded). > > I only have the simple requirement to substitute a font reference with a > particular standard base 14 > font. I am trying to incorporate this feature without spending too much time > adding new code or > creating and managing new configuration schemes. If I implement it the way I > suggested its maybe > only 1/2 - 1 day of work. > > Adrian. > > Jeremias Maerki wrote: > > Sounds a little fop-dev-ish to me, but here goes: > > > > Sounds to me like you're unhappy with the font substitution rules > > built into FOP. If FrutigerLight isn't found, FOP currently switches to > > the "any" font which is mapped to "Times" already. > > > > Let's not forget PANOSE information that can "help" doing automatic font > > substitution. But that's not available for Type 1 fonts. But if FOP had > > a database of such PANOSE records it could map missing fonts to another > > font that has similar properties. But in such a case Frutiger would > > probably be mapped to Helvetica rather than Times as it's a sans-serif > > font. > > > > But I guess you're talking about explicit font substitution. > > > > Rather than targetting base 14 fonts only, I'd look at font substitution > > in general as this is getting more important now that we have automatic > > font detection. The detected fonts might not always be registered in the > > exact way someone would like to use them. An example: > > > > Take "Arial". In Windows you get the Arial font family in normal and > > bold font-weight variants. But there's also "Arial Black". FOP currently > > does this: > > > > font-family "Arial", triplets: > > - font-weight="400" (Arial.tff) > > - font-weight="700" (ArialBD.tff) > > > > font-family "Arial Black", triplets: > > - font-weight="400" (Ariblk.ttf) > > > > But some people (I, for example) might actually prefer this: > > font-family "Arial", triplets: > > - font-weight="400" (Arial.tff) > > - font-weight="700" (ArialBD.tff) > > - font-weight="800" (Ariblk.ttf) > > > > This cannot happen automatically because there's not enough information > > in the font files to do something like that reliably. > > > > If I had to make a suggestion to cover both your and my requirement I'd > > do something like this: > > > > <font-substitution-catalog> > > <substitution> > > <from font-family="Arial" font-weight="800..900"/> > > <to font-family="Arial Black"/> > > </substitution> > > <substitution> > > <from font-family="FrutigerLight"/> > > <to font-family="Times"/> > > </substitution> > > </font-substitution-catalog> > > > > The values on "from" are used as restrictions for font matching. The > > values in "to" specify the values that will be replaced in relation to > > the originally matched font triplet. This looks quite similar to what > > you proposed but is more versatile. > > > > To play the above through: > > font-family="Arial" font-weight="400" > > --> font-family="Arial" font-weight="400" > > > > font-family="Arial" font-weight="800" > > --> font-family="Arial Black" font-weight="800" > > > > font-family="FrutigerLight" font-weight="400" > > --> font-family="Times" font-weight="400" > > > > Please note that our concept of font-triplets is still incomplete in > > terms of coverage of the XSL spec. For examples, "font-stretch" is not > > respected here. In the end, this should actually be a "font-quadruple". > > Better choose a different name. ;-) > > > > WDYT? If you don't get any feedback from any user here I think it's > > better to move this to fop-dev as it becomes a design discussion. > > > > On 23.04.2008 14:28:21 Adrian Cumiskey wrote: > >> Hi all, > >> > >> As most of you probably already know, you are currently able to map font > >> references to a custom font > >> as follows :- > >> > >> <!-- register a particular font --> > >> <font metrics-url="file:///C:/myfonts/FTL_____.xml" kerning="yes" > >> embed-url="file:///C:/myfonts/FTL_____.pfb"> > >> <font-triplet name="FrutigerLight" style="normal" weight="normal"/> > >> </font> > >> > >> But currently there is no provision for mapping a font reference to a base > >> 14 font. I am looking to > >> implement this feature and suggest the following configuration :- > >> > >> <!-- register a font reference 'FrutigerLight' as the base 14 font 'Times' > >> --> > >> <font base14="Times" style="italic" weight="normal"> > >> <font-triplet name="FrutigerLight" style="italic" weight="normal"/> > >> </font> > >> > >> And possibly... > >> > >> <font base14="Times"> > >> <font-triplet name="FrutigerLight" /> > >> </font> > >> > >> ...could map all flavours of FrutigerLight (style=normal,bold,italic > >> weight=normal,bold) references > >> to matching base 14 'Times' font flavours? Or should it just default to > >> normal? > >> > >> Hope some people will find this new feature useful, and any suggestions or > >> feedback on these > >> suggested configurations would be gratefully appreciated. > >> > >> Adrian. > > > > > > > > Jeremias Maerki > > Jeremias Maerki