Applying TrueType Collection Fonts in Reports
You might find that well-designed reports in Designer become truncated when you run the reports on Server on a different platform. The reason is that various platforms use different font systems, and when JDK maps fonts to a different platform, the reports may appear with discrepancies. To solve this problem, Report adopts the TrueType Collection Font (TTC) administrative system of Java. You can design reports with TTC fonts in Designer. Then, when you publish the reports to the runtime environment, you can publish the TTC font files together with the reports so the output is independent of platform fonts. Report also provides the PDF embedded fonts solution, meaning Report can embed TTC fonts in the PDF output, so users do not need to install the fonts on their local machines. This topic describes how you can design reports with TTC fonts, apply the Bold and Italic properties to TTC fonts, deliver TTC fonts to the runtime environment, and export reports with TTC fonts in different formats.
The following sections describe how to use TTC fonts in your reports and view TTC font output in a web browser:
- Designing Reports with TTC Fonts
- Applying Bold and Italic Properties to TTC Fonts
- Publishing TTC Fonts to the Runtime Environment
- Delivering TTC Fonts in Excel/RTF/HTML/TXT
- Using TTC Fonts in Web Browsers
- Delivering TTC Fonts in PDF
Designing Reports with TTC Fonts
When you design reports that you want to run on a platform different from where you design them, it is best to use TTC fonts when the required typeface is distributed as a TrueType Collection.
To design reports with TTC fonts
Copy the TrueType Collection font files *.ttc to the <designer_install_root>\font directory of Designer. You can find TTC fonts in your system's Font directory or from other trusted font sources.
In Designer, open a report and select the text to which you want to apply the TTC font.
On the Home menu bar, select the drop-down arrow of the font list and scroll down to the bottom of the list. You can then find the fonts with *** before their names. These are the TTC fonts you have copied. Select the TTC font you want to apply.
Preview the report and save it when you are satisfied with the result.
After upgrading JDK to v17, if you find the TTC font you apply in a report slightly shifts upwards in the report output, you can add the -Dlogireport.applyLeading4Ascent option in Designer's startup file JReport.bat/JReport.sh in <install_root>\bin to improve the display, for example, -Dlogireport.applyLeading4Ascent="***MS Mincho;***MingLiU".
Applying Bold and Italic Properties to TTC Fonts
Designer supports the Bold and Italic properties for TTC fonts. When you select a TTC font and set the Bold/Italic property to "true", Designer first searches the <designer_install_root>\font directory automatically to check all the TTC files related to the TTC font you selected. If there is a TTC file containing the required Bold/Italic style, Designer uses the font style defined in that file to match your setting and make the Bold/Italic property take effect; if not, Designer finds the specified font in your platform fonts and applies the Bold/Italic property directly.
Publishing TTC Fonts to the Runtime Environment
When you publish reports from Designer to Server, if the reports use TTC fonts, Designer prompts you with the Publish Additional Resources dialog box to publish the font files at the same time. After Designer finishes the publishing task, you can find the corresponding TTC font files in the <server_install_root>\font directory of Server.
Delivering TTC Fonts in Excel/HTML/TXT/RTF
For report outputs in Excel, HTML, TXT, and RTF, they can automatically find TTC fonts from the system's Font directory to display the fonts correctly. However, to avoid any discrepancy in report outputs, if you want to deliver the report in these formats, you should choose TTC fonts that are common on the target client systems. When you have to use fonts that do not exist in the client's system, you can choose the embedded TTC font solution as shown in the following section.
Using TTC Fonts in Web Studio and Page Studio
When viewing report output in a web browser, the browser can only display TTC fonts if the required TTC font is present in the client operating system or if the page provides a browser-supported web font. Most browsers do not load *.ttc files directly via CSS as web fonts. Therefore, for HTML output or web report output opened by users in browsers, it should not be assumed that publishing the TTC file to the server is sufficient for the browser to render text using that font.
To ensure TTC font output displays correctly in web browsers, please use one of the following methods:
Install the required TTC fonts on every client machine that will open the report via a browser. This way, when the report output references the same font family name, the browser can use the local font.
If fonts need to be provided from a web application, convert or provide the required fonts in browser-supported font formats such as TTF or OTF.
When users access the server from different platforms or browsers, verify the report output in the target browser. If the TTC font is not available, the browser may substitute other fonts, which could change text width, line breaks, or character display.
Delivering TTC Fonts in PDF
To view PDF outputs with other character sets, for example, Chinese, Japanese, or Korean fonts, users may need to install special language packages. Also, if you design reports with fonts that are not within Acrobat's internal fonts, Acrobat maps them differently. The two cases cause trouble to users when they view or print a report with Acrobat Reader. However, different from Excel, HTML, TXT, and RTF, PDF enables the embedding of the font description within a file. Report therefore provides the embedded TTC font solution for PDF outputs. You can find it extremely helpful in the following cases:
When you select TTC fonts to design a report, and these fonts are not within the client's existing font systems.
When you have used TTC fonts and Acrobat Reader would otherwise need to be updated with a language extension package to view the result, but you do not want to trouble users with it.
By embedding TTC fonts, the file size increases a little. However, it is still of reasonable size to be transferred over a network.
To take advantage of the PDF Embedded TTC Font feature (this feature is not supported on library components), take the following steps:
Open the report.
In the Report Inspector, select the node representing the page report tab or web report and find its Embedded Fonts property. The value drop-down list of the property shows all the TTC fonts the report uses. You can select multiple fonts by holding down the Ctrl or Shift key.
Save the report and export it to PDF. Designer embeds the selected TTC fonts in the PDF output.
When you select an embedded font while using TTC fonts to design reports and set the Bold/Italic property to "true", if Designer can find the related TTC file to match your setting, Designer also embeds the matched font with the Bold/Italic property when you export the report to PDF.
Using -D Options to Customize TTC Fonts in PDF Output
You can add the following options in Designer's startup file JReport.bat/JReport.sh in <install_root>\bin to specify some TTC font properties in your PDF output.
-
-Dlogireport.pdf.UsePdfFontAscent
Use this option when you want to apply the float ascent value in the PDF font for embedded TTC fonts in your PDF output (by default, Designer applies that of the JDK font). The value of this option can contain multiple items separated by the ";" character. Each item should be a TTC font name starting with "***" or the AllEmbeddedTTF keyword, for example, -Dlogireport.pdf.UsePdfFontAscent="***MS Mincho;***MingLiU;AllEmbeddedTTF".When one of these items is AllEmbeddedTTF, Designer applies the ascent of the PDF font for all embedded TTC fonts in the PDF output.
When none of these items is AllEmbeddedTTF, Designer only applies the ascent of the PDF font for the embedded TTC fonts whose names you have included in this option.
-
-Dlogireport.pdf.MapToTTF
Use this option to map non-TTC fonts to TTC fonts in the PDF output. The value of the option can contain multiple items separated by the ";" character. Each item should either be a font name that does not start with "***" in the Font Face property drop-down list, or be the keyword All, for example, -Dlogireport.pdf.MapToTTF="Arial;Times New Roman;All".When one of these items is All, Designer tries to map each non-TTC font in the report template to a TTC font if there is a matched TTC file in the <install_root>\font directory of Designer.
When none of these items is All, for each item, if it is used in the report template, Designer tries to map it to a TTC font.
-
-Dlogireport.pdf.EmbeddedFonts
Use this option to specify the TTC fonts you want to embed into the PDF output. The value of the option can contain multiple items separated by the ";" characters. Each item should either be a TTC font name that starts with "***" in the Font Face property drop-down list, or be the keyword All, for example, -Dlogireport.pdf.EmbeddedFonts="***MS Mincho;***MingLiU;All".When one of these items is All, Designer embeds every TTC font in the report template into the PDF output.
When none of these items is All, for each item, if it is used in the report template, Designer embeds the TTC font into the PDF output.
Comments
0 comments
Please sign in to leave a comment.