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

2001-08-17 Thread Randall Parker

I modified the test case to make it easier to interpret the results. See the attached 
file. This version generates only a PDF 
with textAsShapes==false. The other PDF and the SVG can be generated by uncommenting 
the calls to do those versions.

What is interesting to note is just which fonts Java recognizes and when fonts, font 
names and font families have the same 
and differing names. 

The basic problem is that a Graphics2D object gets told by setFont which fonts to use. 
But most of the fonts that are legal 
for PDF do not have the same name in Java. For most of the fonts recognized by PDF 1.3 
spec as core one can't even 
create a Font object  Java that matches the font object names that FontSetup. What is 
needed is for FontSetup and 
FontInfo to be able to recognize and match the common variations of font names and 
font families in Java to the similar but 
slightly different names that PDF expects. 

On Fri, 17 Aug 2001 10:53:33 -0700, Randall Parker wrote:

>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. 
>
>
>
>
>



 TestCase1.java

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


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

2001-08-17 Thread Randall Parker

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. 





 TestCase1.java

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]