Using External Fonts

BI Publisher enables you to use external fonts in the output that are not normally available on the server.

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 BI Publisher to access the font at runtime.

Note:

External fonts are supported for PDF output only.

To use external fonts

  1. Use the font in the template.

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

    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. Place the font on the BI Publisher server in the ORACLE_HOME/common/fonts directory.

    Note:

    The predefined fonts are located in the Oracle Business Intelligence Oracle home, in: ORACLE_HOME/common/fonts. The font location is set by the XDO_FONT_DIR variable. If this variable is not set in your environment, then the fonts are located in $JAVA_HOME/jre/lib/fonts.

  3. Set the BI Publisher "font" property.

    You can set the font property for the report in the BI Publisher 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. See Configuring Report Properties.

    To set the property in the configuration file:

    1. Update the BI Publisher configuration file "fonts" section 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>
      

    To set the properties in the BI Publisher configuration file, see Administrator's Guide for Oracle Business Intelligence Publisher.

Now you can run the report and BI Publisher uses the font in the output as designed. For PDF output, the advanced font handling features of BI Publisher 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.

Testing Fonts

Use the template viewer to test fonts.

Ensure that the required fonts are mapped correctly to avoid any font related issues such as Romanian alphabets not being displayed. The font family name in the font mapping should exactly match the name used in the template.
  1. Run the template viewer.
  2. Navigate to the Setting tab.
  3. Load the xdo.cfg configuration file containing the font mapping.
    For example, the Arial font is set in the xdo.cfg file as follows:
        <font family="Arial" style="italic" weight="bold">
             <truetype path="D:\fonts\arialbi.ttf" />
         </font>
    
  4. Reload the xdo.cfg configuration file if you make any changes to it.
  5. Run the report.

Using the Barcode Fonts Shipped with BI Publisher

There are several fonts that output barcodes included with BI Publisher.

The following table describes the barcodes that are included with BI Publisher.

Font File Supported Algorithm

128R00.TTF

code128a, code128b, and code128c

B39R00.TTF

code39, code39mod43

UPCR00.TTF

upca, upce

When you use one of these prepackaged fonts, BI 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 it is not necessary that you apply the barcode font to the field in Microsoft Word. Instead, you can map the font that you apply to the field using BI Publisher's font mapping. At runtime, BI 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 is not used elsewhere in the template. For information on font mapping, see Configuring Report Properties.

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. See Configuring Fonts for the BI Publisher Template Builder.

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'?>

    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.

    Examples:

    <?format-barcode:INVOICE_NO;'code128a'?>
    
    <?format-barcode:INVOICE_NO;'code39mod43'?>
    
    <?format-barcode:INVOICE_NO;'upca'?> 
    
  3. In Microsoft Word, apply the font to the field. If you have not installed the barcode fonts on your client machine, then select a font that is not 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, see Configuring Report Properties.

Note the following:

  • Microsoft Word may not render the barcode fonts properly even when they are 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.

Implementing Custom Barcode Formats

If you choose to use a custom barcode instead, use this procedure to implement a custom barcode.

BI 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 BI Publisher that can then be instantiated at runtime to apply the formatting in the template. For information, see Advanced Barcode Font Formatting in Developer's Guide for Oracle Business Intelligence Publisher.

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

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

Encoding 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

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.

For example:

<?format-barcode:LABEL_ID;'Code128a';'XMLPBarVendor'?>

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.