You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jim Ross <TA...@bjc.org> on 2002/12/18 21:40:17 UTC

fixed-width fonts are not fixed-width in FOP print

Greetings,

I am trying to use FOP (v0.20.4) from within a Java application to create a printed report that 
contains very precise spacing.  For example, I might have a column of numbers such as:
   9.5
  17.23
1492.1
that I need to line up on the decimal point.

I have attempted to do this using a fixed-width font (Courier) along with white-space-collapse="false".  

I have tried two possible approaches:

    1. Use PDFRenderer - When I test this (courtesy of the built-in FO functionality in XMLSpy5), my printed output is EXACTLY what I want.  However, this means an intermediate PDF file being written, followed by a user action to open the file in Acrobat Reader and print it.  My requirement is that there be no user interaction, so this option is out.

    2. Use AWTRender - I can print the exact same reports without user interaction by adapting the code from the org.apache.fop.apps.PrintStarter.   Unfortunately, my fixed-width font is no longer fixed-width.  In PrintStarter, AWTRenderer is extended, so I assume this is a shortcoming of AWT?

I have verified that the fonts I have attempted to use are available by using .getAvailableFontFamilyNames() in GraphicsEnvironment.

Does anyone have any advice how I can get my fixed-width fonts to truly be rendered as fixed-width, without an intermediate PDF file?

Thank you,
   Jim Ross
   Saint Louis, MO



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: fixed-width fonts are not fixed-width in FOP print

Posted by Oscar Schoof <Os...@omegam.nl>.
> 
>contains very precise spacing.  For example, I might have a column of numbers such as:
>   9.5
>  17.23
>1492.1
>that I need to line up on the decimal point.
>
>Does anyone have any advice how I can get my fixed-width fonts to truly be rendered as fixed-width, without an intermediate PDF file?
>
>  
>
Jim,

you could try another approach (as i do myself in our chemical analysis 
reporting).
Devide the numbers in two parts: one containing the part before the 
decimal point and one containing the rest. Use two columns in your table 
for these devided results, the left one with the text aligned to the 
right and the right one with the text aligned to the left.

Oscar



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org