You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Randall Parker <ra...@nls.net> on 2001/08/17 19:53:33 UTC

Test Case FOP and Java don't recognize and name fonts in compatible ways

The core fonts for PDF do not have names that match with the names that Java uses for what are really the same fonts and font families. So if one tries to initialize fonts using names that are 
from the PDF font list as implemented in org.apache.fop.render.pdf.FontSetup the Java run-time doesn't recognize the names and maps them to a different default font family instead. But that 
font family is not one that is in FontSetup.java.

In the case of sansserif its pretty simple: Java uses sansserif whereas FontSetup uses sans-serif. There is code that maps sanserif to sans-serif but sanserif is not spelled the same as 
sansserif. (I've pointed this out a week or two ago in a previous message btw)

However, sansserif is not the only font that has this problem. See the initFonts() method in the attached TestCase1.java.

One other problem is that Java concatenates the style onto the base name to create the name and the family name. This further ensures that FontInfo.java will fail to get a match when it does 
font look-ups. This seems like a dumb thing for the Java run-time to do since font-style is supposed to be used for that purpose in CSS.

I think FontInfo.java and FontSetup.java have to be smarter to map the font families and names that Java's run-time recognizes to font families and font names that are PDF-compatible. 

I've attached a newer version of my TestCase1.java test case program. This one instantiations a variety of fonts and then does System.out.printlns that show what Java thinks they are. It also 
shows error messages that org.apache.fop.layout.FontInfo.java generates because does not recognize many of these fonts.