Fonts in compatibility reports
In compatibility mode, you might find that the font size is too small or has other unexpected behavior. There are a few tricks you can use to alleviate this problem.
Font issues typically occur because the font used by Genero Report Writer (always a monospace font such as Courier) does not have the same character aspect ratio as the font used by the original report (the font built into the impact printers). This changes the maximum number of characters per line and the number of maximum lines per page, so that the report pages cannot be filled the same way as the original.
The font size is determined by the number of characters that are displayed in the horizontal. The more characters per line, the smaller the font size. For example, 132 characters per line results in a font size of 10, while 80 characters per line results in a font size of 12. This font size might be smaller than necessary and produce unwanted margins.
Specify the printable area
You can specify the printable area (the space within the margins) using the API functions:
fgl_report_configurePageSize(pageWidth,pageHeight)
fgl_report_setPageMargins(topMargin,bottomMargin,leftMargin,rightMargin)
Specify the right margin
In a 4GL report, the characters per line is specified by the optional RIGHT MARGIN parameter in the OUTPUT section. If RIGHT MARGIN is not specified, the graphical output assumes 80 characters per line.
You can override the specified RIGHT MARGIN for multiple reports using the
pageWidthInCharacters
parameter in the fgl_report_configureCompatibilityOutput
function:
fgl_report_configureCompatibilityOutput(pageWidthInCharacters, fontName, fidelity, reportName, reportCategory, systemId)
Place text within the printable area
The text output is printed starting at the upper left corner of the printable area.
The text can be shifted to the right and downward using the function
fgl_report_setPageMargins()
.
This solution gives finer control on the placement of text and allows margin values to be changed at runtime. However, for existing reports where the exact text placement is required, such as the placement of an address within an envelope window, you will need to adjust the placement.
Why unwanted margins appear
Depending on the dimensions of the printable area and the number of lines and columns to be printed, you might see additional margins at the right or bottom of the page. This is caused by a mismatch of the aspect ratio. For example, the "Nimbus Mono" characters have a ratio of 3/5, while "Courier" has an aspect ratio of 0.425. Fonts with lower values appear taller and more condensed than fonts with higher values.
For example, you want to print a report with 69 lines by 80 columns using the font "Nimbus Mono". The report will be printed onto a page in the format "letter" (11" x 8.5") with 0.5" margins on each side. The printable area has the dimensions 10" x 7.5". The maximum height of a line is 10"/69=10.43 point and the maximum width of a column is 7.5"/80=6.75 point. However, if you select a font size that yields a line height of 10.43 point, then the lines will only be 80*10.43*3/5=6.95" wide, leaving a gap of 0.55" on the side.
Run the "MonospaceTest" program
The MonospaceTest
program can list the ratio of the
different monospaced fonts installed on a system and compute which font produces the
smallest margin for a particular report.
The program operates in two modes depending on the command line arguments:
- List Mode
- Invoke the
MonospaceTest
program without command line arguments. The program lists all monospaced fonts on the system, grouped by their specific aspect ratios. For each font group, it suggests layouts for common page formats and margin values. - Search mode
- Invoke the
MonospaceTest
program with four arguments:heightOfPrintableAreaInMM
,widthOfPrintableAreaInMM
,lines
, andcols
". The program computes which font produces the smallest margins.
- Compile the program:
javac MonospaceTest.java
This creates the following files in the current directory:
$ls -l *.class -rw-r--r-- 1 alex alex 341 2010-08-17 12:24 MonospaceTest$Value.class -rw-r--r-- 1 alex alex 654 2010-08-17 12:24 MonospaceTest$MMValue.class -rw-r--r-- 1 alex alex 686 2010-08-17 12:24 MonospaceTest$InchValue.class -rw-r--r-- 1 alex alex 726 2010-08-17 12:24 MonospaceTest$Entry.class -rw-r--r-- 1 alex alex 6944 2010-08-17 12:24 MonospaceTest.class
- Run the program by typing the following in the directory containing the compiled
"class"
files:
java MonospaceTest [args]