Monday, October 3, 2011

Troubleshooting Guide for Font Aliasing / Font Subsetting / Font Embedding Issues

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE

Problem: Troubleshooting Guide for Font Aliasing / Font Subsetting / Font Embedding Issues

The purpose of this document is to give some tips / hints to solve Font aliasing / Font Subsetting / Font embedding issues.


1) Why Font aliasing ?
In order to be able to format the output, Reports MUST have access to Font Metric information (AFM files for a "Postscript Printer" environment).

If "Font Metric" information is not available for a Font used in a report, Reports will "alias" this font with another Font for which Font Metric Information is available.
The file uifont.ali may be used to give "directives" for the font aliasing.
If there are no directives for a Font or if the directives cannot be used, Oracle Reports will look for the nearest matching font under the same character set which can be used instead.
This problem may occur when you develop your reports on a given platform type (Windows) and deploy it on another platform type (UNIX).
For more details about Font management in Reports :
Oracle Application Server Reports Services Publishing Reports to the Web
10g Release 2 (10.1.2)
2) Validate the files used by the Font aliasing
The first step in debugging a Font aliasing issue is to verify the files used by Reports:
uifont.ali / uiprint.txt / PPD files / AFM files
Errors in these files may lead to problems during Font Aliasing without giving any error messages.
a) Validate the file uifont.ali:

A utility is provided in the directory <ORACLE_HOME>/bin to check the file uifont.ali:
Reports 9.0.x
Reports 10.1.2.x / 11.1.1.x
If you call this utility without any parameters, the "standard" uifont.ali will be validated.
Example on UNIX :
Parsing font alias file "/oracle/oas1012/midtier/guicommon/tk/admin/uifont.ali"
Successfully parsed font alias file
Error Example :
Parsing font alias file "/oracle/oas1012/midtier/guicommon/tk/admin/uifont.ali"
Courier New = cour.ttf
Error at line 279: Invalid font specification
Parse of font alias file failed
In this example, the font name Courier New must be enclosed between quotes:
"Courier New" = cour.ttf
b) Check the files AFM / PPD / uiprint.txt / uifont.ali :
These files may have been modified on Windows and transferred to UNIX. If they have been transferred in binary mode, some <carriage return> may be left in these files and will prevent the Font aliasing.
To check if <carriage return> have been left, use the UNIX utility 'od' with the option -a:
(According to the platform, the command can be od -a or od -t a )

cd $ORACLE_HOME/guicommon/tk/admin/AFM
od -a * | grep -i cr

cd $ORACLE_HOME/guicommon/tk/admin/PPD
od -a * | grep -i cr

cd $ORACLE_HOME/guicommon/tk/admin
od -a uiprint.txt | grep -i cr

cd $ORACLE_HOME/guicommon/tk/admin

od -a uifont.ali | grep -i cr

The command "od -a * | grep -i cr" should return no line.
If lines are returned by the command "od -a * | grep -i cr ", you can use a script, like the example below, to find the file(s) containing the <carriage return>.
for fic in `ls *`
(od -a $fic | grep -i cr) && echo "File containing a Carriage Return: " $fic
Note: The commands above are for Reports 10.1.2.
For Reports 9.0.2 / 9.0.4, replace /guicommon/tk by /guicommon9/tk90.
3) List of Fonts available in the "Postscript Printer" environment
In the PPD file, the AFM files associated to the PPD are listed under:
*% Font Information =====================
For example:
*% Font Information =====================
*DefaultFont: Courier
*Font Courier: Standard "(001.004)" Standard ROM
*Font Courier-Bold: Standard "(001.001)" Standard ROM
*Font Courier-BoldOblique: Standard "(001.001)" Standard ROM
*Font Courier-Oblique: Standard "(001.001)" Standard ROM
*Font Helvetica: Standard "(001.001)" Standard ROM
*Font Helvetica-Bold: Standard "(001.001)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(001.001)" Standard ROM
*Font Helvetica-Oblique: Standard "(001.001)" Standard ROM
*Font Symbol: Special "(001.001)" Special ROM
*Font Times-Bold: Standard "(001.001)" Standard ROM
*Font Times-BoldItalic: Standard "(001.001)" Standard ROM
*Font Times-Italic: Standard "(001.001)" Standard ROM
*Font Times-Roman: Standard "(001.001)" Standard ROM

The AFM files must exist in the AFM directory (<ORACLE_HOME>/guicommon/tk/admin/AFM by default), else a warning message is returned by
For example :
Given the following line has been added in the PPD file:
*Font NotExist: Standard "(V.2)" Standard ROM
As the file NotExist does not exist in the directory <ORACLE_HOME>/guicommon/tk/admin/AFM, the following message is displayed when launching
Can't open AFM file(s):
The font name used by Reports for an AFM file is the Font name specified in the attribute "FamilyName".
For example:
FamilyName Helvetica

4) Build a very simple report to debug the Font aliasing issue
It is always easier to work with a report using only one Font.
To more easily debug any Font aliasing problems, create a simple new report for the debugging which has:

- No SQL Query.
- Just a boilerplate text in the Paper Layout.
- Set the boilerplate text Font to the Font you want to test.
5) Use your "private" environment for the tests
It is possible to test with "private" AFM / PPD / uifont.ali and uiprint.txt files, instead of using the files in the default location of $ORACLE_HOME/guicommon/tk/admin.

You can modify any "private" file without any impact on the Reports Server.

Directory and environment variables to use to build a "private environment":
Reports 9.0.x
Reports 10.1.2.x / 11.1.1.x
$ORACLE_HOME /guicommon9/tk90
Location of PPD files
Location of AFM files
Location of HPD files
Location of TFM files
Location of uifont.ali
Location of uiprint.txt
Remark : These variables can be used only on UNIX platforms. On Windows the PPD/AFM/HPD/TFM directories do not exist and the file uiprint.txt does not exist.. To use another file uifont.ali than the default one on Windows, use the variable UI instead of TK_FONTALIAS
Steps to create your "private environment":
# Create the directory testaliasing in $ORACLE_HOME/guicommon/tk
cd $ORACLE_HOME/guicommon/tk
mkdir testaliasing
# Create the directories AFM and PPD in $ORACLE_HOME/guicommon/tk/testaliasing
cd $ORACLE_HOME/guicommon/tk/testaliasing
mkdir AFM
mkdir PPD
# Copy the AFM files to your private directory:
cp $ORACLE_HOME/guicommon/tk/admin/AFM/* $ORACLE_HOME/guicommon/tk/testaliasing/AFM
# Copy the PPD files to your private directory:
cp $ORACLE_HOME/guicommon/tk/admin/PPD/* $ORACLE_HOME/guicommon/tk/testaliasing/PPD
# Copy the files uiprint.txt and uifont.ali to your private directory:
cp $ORACLE_HOME/guicommon/tk/admin/uiprint.txt $ORACLE_HOME/guicommon/tk/testaliasing
cp $ORACLE_HOME/guicommon/tk/admin/uifont.ali $ORACLE_HOME/guicommon/tk/testaliasing
# Copy the file
# Copy the file

Edit the file $ORACLE_HOME/bin/, and change the line:


Edit the file $ORACLE_HOME/bin/, and add the following lines:
################### Reports Private Environment Variables #########################################
TK_PPD=$ORACLE_HOME/guicommon/tk/testaliasing/PPD ; export TK_PPD
TK_AFM=$ORACLE_HOME/guicommon/tk/testaliasing/AFM ; export TK_AFM
TK_HPD=$ORACLE_HOME/guicommon/tk/testaliasing/HPD ; export TK_HPD
TK_TFM=$ORACLE_HOME/guicommon/tk/testaliasing/TFM ; export TK_TFM
TK_FONTALIAS=$ORACLE_HOME/guicommon/tk/testaliasing ; export TK_FONTALIAS
TK_UNKNOWN=$ORACLE_HOME/guicommon/tk/testaliasing ; export TK_UNKNOWN
REPORTS_PATH=$ORACLE_HOME/guicommon/tk/testaliasing:$REPORTS_PATH ; export REPORTS_PATH
TK_PRINTER=printer_ps ; export TK_PRINTER
Remark: The printer printer_ps must be defined in the file $ORACLE_HOME/guicommon/tk/testaliasing/uiprint.txt:
printer_ps:postscript:2:Test PostScript Printer:default.ppd:
To use the "private" aliasing environment, execute the report with the script report=test destype=file desname=/tmp/test.html desformat=html

6) Check the Font name used in the RDF

To check what exact Font name is used in the report, you can search the XML version of your report.

To generate the XML file, you can:

- Save the RDF as XML using Reports Builder,


- Convert the RDF into XML. Sample syntax: stype=rdffile source=test.rdf dtype=xmlfile dest=test.xml (UNIX)

rwconverter.exe stype=rdffile source=test.rdf dtype=xmlfile dest=test.xml (Windows)

Once you have the XML file, you search for the string "face=" in the XML file:

grep -i face= /tmp/myreport.xml (UNIX)

Example (UNIX):
> stype=rdffile source=test.rdf dtype=xmlfile dest=test.xml batch=yes

Report Builder: Release - Production on Mon Dec 12 12:07:47 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
REP-25200: Converting 'test.rdf' to 'test.xml'...
>grep -i face= test.xml
<font face="Helvetica" size="14" bold="yes" italic="yes"/>
<font face="Helvetica" size="12" bold="yes"/>
<font face="Helvetica" size="12" bold="yes"/>
<font face="Helvetica" size="12" bold="yes"/>
<font face="Arial" size="12" bold="yes"/>
<font face="Helvetica" size="36" bold="yes" italic="yes"/>
<font face="Helvetica" size="20" bold="yes" textColor="gray64"/>

7) Check the font used in the output after the "Font Aliasing"
The easiest way to check the Font name used in an output generated by Reports is to use DESFORMAT=HTML.
Since the HTML output is a text file, the Font name used can be easily found.
For example, execute the report with:



Check the font name used in the output by searching for the string "face=":

grep -i face= /tmp/font_aliasing.html
8) PDF Font aliasing
The Font name in PDF is case sensitive. In some cases, the Font name generated by Reports may be wrong.
Step 1) Check the Font name used in the PDF file by searching for the string "basefont":
grep -i basefont test.pdf
Example :
>grep -i basefont /tmp/test.pdf
/BaseFont /Helvetica-Bold
Step 2) Check the Font name used by Acrobat Reader to display the PDF document:
From Acrobat Reader 7.0
File -> Document Properties ...
Tab "Fonts"
Check the value of "Actual Font".
Step 3) If the Font name generated by Reports is not correct (Uppercase problem / Space in the font name is missing / ...), then you can use the [ PDF ] section in the uifont.ali file.
Example :
[ PDF ]
fontname1 = FontName1
fontname2 = "Font Name 2"
Remarks :
a) This [PDF] section is read after the "Font Aliasing". The font name, specified at the left of the equal sign, must be the font name after the "Font Aliasing" has occurred.
b) This section should be used ONLY to fix UpperCase / LowerCase / Space problems in the Font Name. It is possible to replace a font name with a totally different font; however, in this case, there may be truncation / overlapping problems in the output.
Example that may lead to truncation / overlapping problems:
[ PDF ]
Arial = "Courier New"
With this setting, the report output will be formatted with the Arial Font metric information, but the Adobe Reader will use the font Courier New, which has totally different font metrics.

9) PDF Font Subsetting / Font Embedding issues
Font Subsetting or Font Embedding always occurs AFTER Font Aliasing . That's why it is important to first check the result of Font Aliasing .
To do Font Subsetting or Font Embedding, you have to add a line in uifont.ali like:
Font Subsetting :
<font name>="<ttf filename>" in the section [ PDF:Subset ].
Windows Font Embedding :
<font name>="<pfm filename> <pfb filename>" in the section [ PDF:Embed ].
UNIX Font Embedding :
<font name>="<afm filename> <pfa filename>" in the section [ PDF:Embed ].
The font name specified at the left of the equal sign is the font name AFTER "Font Aliasing" has occurred. So, if the font chosen by Reports during the Font Aliasing is not the one specified at the left of the equal sign, then the Subsetting or Embedding will not take place.
If you have problems with Font Subsetting or Font Embedding, generate a HTML output and check the font name used in the HTML file.
During Font Subsetting / Font Embedding , ttf / pfm /pfb / afm / pfa files are used. These files must be accessible to Reports (in REPORTS_PATH) and readable (Access rights on UNIX). UNIX trace utilities, such as strace or truss, may be used to debug problems that you suspect to be access related.

Doc ID 110888.1 How to Trace Unix System Calls
Doc ID 882227.1 How to Know if Font Subsetting / Font Embedding Has Been Used by Oracle Reports when Generating a PDF output ?

10) Problems related to the Character Set
In order to check if the problem is related to the Character Set, always test generating an output with
If the problem does not occur when NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1, modify the AFM files as described in the following note:

Doc ID 300416.1 Symbol Characters ("Greek") Instead Of Expected Characters Are Displayed in Reports or Reports Parameter Form
This Character Set problem is also described in the document:
Oracle Application Server Reports Services Publishing Reports to the Web
10g Release 2 (10.1.2)
Repairing Garbled Fonts When Using the WE8ISO8859P15 Character Set
This problem may occur for character sets other than WEISO8859P15 (UTF8 , EE8ISO8859P2, ...).
Here is an example of script to modify the EncodingScheme value in the AFM files:
1) Create a new directory AFM2 under $ORACLE_HOME/guicommon/tk/admin

2) Create the following script in the directory $ORACLE_HOME/guicommon/tk/admin/AFM
for filename in *
sed "s/EncodingScheme AdobeStandardEncoding/EncodingScheme FontSpecific/" $filename > ../AFM2/$filename

3) Save the script and give execute permissions (In the example below, the script is called

chmod a+x

4) Execute the script

5) Change the name of the directory AFM into AFM_backup :
cd $ORACLE_HOME/guicommon/tk/admin
mv AFM AFM_backup

6) Change the name of the directory AFM2 into AFM :
cd $ORACLE_HOME/guicommon/tk/admin
If you are using a "private environment", you can modify the AFM files in the directory specified in TK_AFM (TK90_AFM).
AFM files created by the utility ttf2pt1 have by default "EncodingScheme FontSpecific".


Troubleshooting Guide for Font Aliasing / Font Subsetting / Font Embedding Issues [ID 350971.1]
< !--[if !supportLineBreakNewLine]-->
< !--[endif]-->

Get Oracle Certifications for all Exams
Free Online


Anonymous said...

Everything is very open with a really clear
clarification of the challenges. It was really informative.
Your website is very useful. Thanks for sharing!
My web page: web design miami beach

Anonymous said...

With havin so much content do you ever run into any issues of plagorism or
copyright violation? My site has a lot of exclusive content I've either created myself or outsourced but it looks like a lot of it is popping it up all over the internet without my agreement. Do you know any solutions to help prevent content from being stolen? I'd truly
appreciate it.
Also see my site > backup camera

Anonymous said...

Oh my goodness! Impressive article dude! Thanks, However I am experiencing issues with
your RSS. I don't know the reason why I can't join it.
Is there anyone else having the same RSS issues?
Anybody who knows the answer can you kindly
respond? Thanx!!
Also see my web site :: reborn