Posted on 1998-10-19
I'm writing a preview report program as an add on to a DOS program. My delima
is how to calculate font sizes for the report data. Im using Java2D for my
printing capabilities (the preview module wont actually be released for 6
months or so)
Is there a standard way to calculate what the font sizes should be given a
report width (whether the user wants to print landscape/portrait and 8.5 X 11/
What Ive started to do is pretty much go through a while loop and start with a
big font and test to see if the font works for how long the line is and decrement
the font until it does work.
This would be ok for fixed width fonts but I would like to use variable width fonts
and be able to still line up the columns for financial data.
I also normally deal in cpi (characters per inch) so I would like to know how the
point size system works (how it is calculated...especially with variable width fonts)
Ive done some research on JTable and pretty much found that it is hard print anything
unless you print the component itself (including the GUI itself.. not just the data)
I need to show the report onscreen probably using the same Graphics object that I
calculated given the PageFormat.. I think I can handle that if I only knew how to
figure out the calculations.
I dont necessarily need code.. just a good description of how things work
I would appreciate any ideas anyone has for this.