9.4 Font Aliasing

Font aliasing is a mechanism in Oracle Reports that allows a font or its associated attributes like style, weight, width, size and character set to be mapped to another desired font or its associated attributes. Its primary use is when applications are ported from one platform to another and the font associated with some or all of the objects in the layout on the source platform do not exist on the target platform. In such cases font aliasing will be helpful as the nonexistent fonts can be mapped to another available one producing the required results. For example, when moving from Windows to Motif one would use font aliasing to map the Windows Arial to a font available on Motif, such as Helvetica.

The font enhancements introduced in Oracle Reports 11g Release 1 (11.1.1) make font aliasing unnecessary in almost all cases. In prior releases, a report may have been created with fonts that are readily available on Windows, but not on UNIX (for example, Arial font). In such cases, it was necessary to alias the Windows fonts to other fonts with a similar style available on UNIX (for example, Helvetica). Now, with support for TTF and TTC files on UNIX, a font such as Arial is supported on both Windows and UNIX, eliminating the need for aliasing.

This section includes the following topics:

9.4.1 Specifying Aliasing Information

If font aliasing is necessary, use Oracle Enterprise Manager to define the aliasing, instead of directly editing the `uifont.ali` file as in prior releases. For information about using Oracle Enterprise Manager for font configuration, see Section 7.9.1, "Configuring Fonts".

9.4.2 Font Aliasing Mechanism

For font aliasing, Oracle Reports searches for entries under the related section in the alias file that matches the original font attributes given in the report. Refer to Section 9.4.3, "Font Alias File Sections" for more information about the sections of the font alias file. If an exact match is found, Oracle Reports maps the original font on the left to the target font on the right.

For example:

```Arial.8.Italic.Medium.Normal.WE8ISO8859P1= Helvetica.12.Plain.Light.Normal.WE8ISO8859P1
```

If an Arial font with all of the attributes listed on the left is found, it will be mapped to a Helvetica font with all of the attributes listed on the right.

Any field can have a blank entry, which means it will be matched regardless. For instance:

```Arial..... = Helvetica.12.Plain.Light.Normal.WE8ISO8859P1
```

In this case, all of the Arial fonts, irrespective of size and other attributes, are mapped to Helvetica with size 12, style Plain, weight Light, having Normal width under character set `WE8ISO8859P1`.

Another way to specify an aliasing rule is:

```Arial = "OCR B"
```

This method will preserve the other attributes of the present font but will change the font name to `OCR B`. You must be certain in such cases about the availability of mapped fonts with the attributes of other fonts. For example, in this rule the Arial font with style Italic might be mapped to the `OCR B` font with Plain style because the `OCR B` font does not have the Italic style present.

After a mapped font is read from the uifont.ali file, Oracle Reports looks for the font following the font lookup procedure, which is described in Section 9.1.2.1, "Font lookup". If the mapped font is found on the system, then Oracle Reports uses this font. Otherwise, it looks for the original font in the system.

Font attributes are searched for with the font face, size, style, weight, and width under the specified character set.

In Oracle Reports, fonts for the Web Source view and PL/SQL editor can be mapped by providing a mapping specification in the `[rwbuilder]` section. This feature is mainly intended for supporting Unicode fonts in these editors.

9.4.3 Font Alias File Sections

The uifont.ali file consists of various sections which contains font mapping instructions for a particular area, as shown in Table 9-5. Since Oracle Reports looks in specific sections for specific purposes, it is crucial that you place your mapping entries in the appropriate section for what you are trying to accomplish.

Table 9-5 Font Mapping File Sections

Section Name Description

`Global`

Applies everywhere.

`Printer`

Only applies to printer output.

`Printer:PostScript1`

Applies to PostScript Level 1 printers.

`Printer:PostScript2`

Applies to PostScript Level 2 printers.

`Printer:PCL5`

Applies to PCL 5 printers.

`Display`

Only applies to the display (the screen).

`Display:Motif`

Applies only to the Motif display.

`Display:CM`

Applies only to character-mode display.

`PDF`

Used for font aliasing (from Oracle Reports 6i) and multibyte language support (from Oracle Reports).

`PDF:Embed`

(Oracle Reports only) Used for Type 1 font embedding.

`PDF:Subset`

(Oracle Reports only) Used for True Type font subsetting.

`RWBUILDER`

(Oracle Reports only) Fonts for the Web source and PL/SQL editor can be mapped in this section.

`printer_name`

A section for a specific printer, such as:

`[Printer:PostScript1:2op813a]`

If you want to look at the `uifont.ali` file, it is located in the following directory on Windows and UNIX:

On Windows: `ORACLE_INSTANCE\config\FRComponent\frcommon\tools\common`

On UNIX: `ORACLE_INSTANCE/config/FRComponent/frcommon/guicommon/tk/admin`

The section for font aliasing in the `uifont.ali` file is `[PDF]`, which defines font mappings using the following formats:

• Single byte fonts:

```[PDF]
"font_name"="font_name"
```
• Multibyte fonts:

```[PDF]
character_set = "font_name"
```

or

```"font_name".....character_set="font_name"
```

Here is an example of a font aliasing entry in the `uifont.ali` file:

```[ PDF ]
/*Alias TrueType to available Type1 font */
"Kino MT" = UtopiaBold
/*Alias multibyte to available CID font */
.....SJIS = "HeiseiKakuGo-W5-Acro"
```

where:

• `"Kino MT" = UtopiaBold` substitutes every `Kino MT` character found with the `UtopiaBold` equivalent.

• `.....SJIS = "HeiseiKakuGo-W5-Acro"` substitutes every multibyte character set found with the `HeiseiKakuGo-W5-Acro` (CID) equivalent.

Order of precedence

When aliasing a particular font, only one section is read based upon the context in which the font is used. Hence, if three sections apply, only one is read. For example, suppose you have three sections: `[Printer]`, `[Printer:PostScript]`, and `[Printer:PostScript:2op813a]`. When generating output, if the printer is `2op813a`, only the mapping rules in section `[Printer:PostScript:2op813a]` are read. For printers other than `2op813a`, Oracle Reports would use the `[Printer:PostScript]` section.

The more specific sections of the alias file take precedence over the more general sections. For example, a specific printer section, such as `[Printer:PostScript1:2op813a]` would take precedence over the `[Printer:PostScript1]` section, which would take precedence over the `[Printer]` section, which would take precedence over the `[Global]` section.

The `uifont.ali` file is the configuration file controlling all of the Oracle Reports PDF font enhancements. The `uifont.ali` file is text readable; that is, you can edit it with a standard text editor. Exercise caution when editing the file. The `uifont.ali` file should be saved as a text file with no formatting or special characters that may corrupt the file.

Note:

Although you can manually edit the uifont.ali file, it is recommended that you use Oracle Enterprise Manager for all font-related configuration tasks.

9.4.4 Font Aliasing File Verification

To verify whether the `uifont.ali` file is correct, you can run the font check utility, which can be found in the `ORACLE_HOME``/bin` directory. It is always advisable to run this utility on the modified `uifont.ali` file to catch any errors:

On Windows:

```fnchk.exe filename
```

On UNIX:

```mfontchk filename
```

where `filename` is the name of the modified `uifont.ali` file. If you don't specify any file name, it will check the default file based on the environment variables.

If the alias file has errors, the utility returns an error message along with the file on which the error was found. For example:

```Parsing font alias file "\$ORACLE_INSTANCE/config/FRComponent/frcommon/guicommon/tk/admin/uifont.ali"
Ms san serif

Error at line 85: Invalid font specification
Parse of font alias file failed
```

The above error indicates that there is a syntax error in `uifont.ali` in the mapping rule for MS San Serif font on line 85.