Use External Fonts

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

  1. Use the font in the template.

    1. Copy the font to the <WINDOWS_HOME>/fonts directory.

      If you want use external fonts, you must have the license for those fonts.

    2. Open Microsoft Word and build the template.

    3. 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.

  2. Use Upload Center to upload the fonts.
  3. 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:

    1. Open the report in the report editor.

    2. Click Properties, then click Font Mappings.

    3. Enter the font and then select the font to which you want to map it.

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 Barcode Fonts in Reports

Publisher includes several fonts that output barcodes.

Font files included with Publisher:

  • LibreBarcode128-Regular.TTF - Supports code128a, code128b, and code128c algorithm.
  • LibreBarcode39-Regular.TTF - Supports code39 and code39mod43 algorithm.
  • 128R00.TTF - Supports code128a, code128b, and code128c algorithm.
  • B39R00.TTF - Supports code39 and code39mod43 algorithm.
  • UPCR00.TTF - supports upca and upce algorithm.

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:

  1. Insert a field in the template where the barcode is to display in the report output.
  2. In the form field, enter the following command:
    <?format-barcode:data;'barcode_type';'barcode_vendor_id'?>
    

    where

    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.

    barcode_vendor_id is the barcode encoder to be used. When the value of the barcode_vendor_id parameter is null or 'Oracle Analytics Publisher' , Publisher chooses either Monotype or Libre encoder depending on the value of the Barcode encoder report property.

    Examples:

    <?format-barcode:INVOICE_NO;'code128a';'Libre'?>
    
    <?format-barcode:INVOICE_NO;'code39mod43';'Libre'?>
    
    <?format-barcode:INVOICE_NO;'upca';'Monotype'?> 
    
  3. 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.
  4. 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:

<?register-barcode-vendor:java_class_name;barcode_vendor_id?>

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:

<?register-barcode-vendor:'oracle.xdo.template.rtf.util.barcoder.BarcodeUtil';'XMLPBarVendor'?>

where

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.

<?format-barcode:data;'barcode_type';'barcode_vendor_id'?>

where

data is the element from the XML data source to be encoded. For example: LABEL_ID

barcode_type is the method in the encoding Java class used to format the data. For example: code128a.

barcode_vendor_id is the barcode encoder to be used. The value of barcode_vendor_id can be null, 'Oracle Analytics Publisher', 'Libre', or 'Monotype'. When the value of the barcode_vendor_id parameter is null or 'Oracle Analytics Publisher' , Publisher chooses either the Monotype or Libre encoder depending on the value of the Barcode encoder report property.

For example:

<?format-barcode:LABEL_ID;'code128a';'Libre'?>

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.