You can use external fonts in the output that are not normally available on the server.
External fonts are supported for PDF output only. To set up a new font for the report output, use the font to design the template on your client machine, then make it available on the server, and configure Publisher to access the font at runtime.
To use external fonts
Use the font in the template.
Copy the font to the
Open Microsoft Word and build the template.
Insert the font in the template: Select the text or form field and then select the desired font from the font dialog box (Format > Font) or font drop down list.
The following illustration shows an example of the form field method and the text method.
Place the font in the ORACLE_HOME/common/fonts directory.
Set the "font" property.
You can set the font property for the report in the Font Mappings page, or in the configuration file.
To set the property in the Font Mappings page:
Open the report in the report editor.
Click Properties, then click Font Mappings.
Enter the font and then select the font to which you want to map it.
To set the property in the configuration file:
- Update the "fonts" section in the configuration file with the font name and its location on the server. For example, the new entry for a TrueType font is structured as follows:
<font family="MyFontName" style="normal" weight="normal"> <truetype path="\user\fonts\MyFontName.ttf"/> </font>
Administrator must set the properties in the configuration file.
Now you can run the report to use the font in the output as designed. For PDF output, the advanced font handling features embed the external font glyphs directly into the final document. The embedded font only contains the glyphs required for the document and not the complete font definition. Therefore the document is completely self-contained, eliminating the need to have external fonts installed on the printer.
Use the Barcode Fonts Shipped with Publisher
There're several fonts that output barcodes included with Publisher.
The following table describes the barcodes that are included with Publisher.
|Font File||Supported Algorithm|
code128a, code128b, and code128c
When you use one of these prepackaged fonts, Publisher executes the preprocessing on the data prior to applying the barcode font to the data in the output document. For example, to calculate checksum values or start and end bits for the data before formatting them.
At design time, you don't need to apply the barcode font to the field in Microsoft Word. Instead, you can map the font that you apply to the field using Publisher's font mapping. At runtime, Publisher applies the barcode font to any field using the base font you specified in the font mapping. Be sure to choose a font that isn't used elsewhere in the template.
If you want to use the font directly in Microsoft Word, then add the appropriate .TTF file to the
C:\WINDOWS\Fonts directory. To use the Template Builder Preview function, map the font in the Template Builder configuration file.
To use the barcode fonts in the report output:
- Insert a field in the template where the barcode is to display in the report output.
- In the form field, enter the following command:
data is the element from the XML data source to be encoded. For example: INVOICE_NO
barcode_type is one of the supported algorithms listed above.
<?format-barcode:INVOICE_NO;'code128a'?> <?format-barcode:INVOICE_NO;'code39mod43'?> <?format-barcode:INVOICE_NO;'upca'?>
- In Microsoft Word, apply the font to the field. If you haven't installed the barcode fonts on your client machine, then select a font that isn't used elsewhere in the template, for example, Bookman.
- Configure the font in the Font Mapping page. For more information about the Font Mapping page.
Note the following:
Microsoft Word may not render the barcode fonts properly even when they're installed on your client. To work around this issue, apply a different font to the field and map the font as described above.
The upca algorithm accepts only UPC-A message string and encodes into UPC-A barcode.
A string of 12 characters is treated as UPC-A message with a check digit, 11 is without a check digit.
The upce algorithm accepts only UPC-E message strings and encodes into UPC-E barcode.
A string of 8 characters is treated as a UPC-E message with both a front and end guard bar; a string of 6 characters is without guard bars.
Implement Custom Barcode Formats
If you choose to use a custom barcode instead, use this procedure to implement a custom barcode.
Publisher offers the ability to execute preprocessing on the data prior to applying a barcode font to the data in the output document. For example, you might need to calculate checksum values or start and end bits for the data before formatting them.
The solution requires that you register a barcode encoding class with Publisher that can then be instantiated at runtime to apply the formatting in the template.
To enable the formatting feature in the template, you must use two commands in the template. The first command registers the barcode encoding class with Publisher. This must be declared somewhere in the template prior to the encoding command. The second is the encoding command to identify the data to be formatted.
Register the Barcode Encoding Class
You can include barcodes in form fields.
Use the following syntax in a form field in the template to register the barcode encoding class:
This command requires a Java class name (this carries out the encoding) and a barcode vendor ID as defined by the class. This command must be placed in the template before the commands to encode the data in the template. For example:
oracle.xdo.template.rtf.util.barcoder.BarcodeUtil is the Java class and
XMLPBarVendor is the vendor ID that is defined by the class.
Encode the Data
Use this syntax in a form field in the template to format the data.
the data is the element from the XML data source to be encoded. For example: LABEL_ID
the barcode_type is the method in the encoding Java class used to format the data (for example: Code128a).
the barcode_vendor_id is the ID defined in the register-barcode-vendor field of the first command you used to register the encoding class.
At runtime, the barcode_type method is called to format the data value and the barcode font is then applied to the data in the final output.