Tuesday, November 11, 2008

Working with Oracle Forms and NLS Language/Globalization issues

Recently, we have problem in displaying thai language fonts in the Report builder (windows) and the Oracle Forms servers (unix).

To solved the problem at the Report Builder, first we need to set the language support at the registry .

In the HKLM/Software/OracleDeveloper then at NLS_LANG, we set from the western code "AMERICAN_AMERICA.WE8MSWIN1252" to the unicode ENGLISH_UNITED_KINGDOM.UTF8.

Then we need to change the NLS_LANG at the file default.env , C:\oracle\product\developer\forms\server. Ame thing add the NLS_LANG at this file.


In the Oracle Forms server,
1) First , you need to determine which PPD file you are using. by using the following to test it,
http://:/reports/rwservlet?report=test.rdf&destype=file&desname=/tmp
/test_rep.ps

The content of this file should contain the output:
% NOTE: This file was generated with the PPD file .ppd

2) Then you need to add your fonts into the PPD file, in my case is the screenprinter.ppd at the guicommon/tk/admin/PPD
at the "*DefaultFont: Courier" add the font name.
*Font ArialUnicodeMS: Standard "(001.004)" Standard ROM

add the below, to use the Arial style (bold, italic) fonts
*Font ArialMT: Standard "(001.004)" Standard ROM
*Font Arial-ItalicMT: Standard "(001.004)" Standard ROM
*Font Arial-BoldMT: Standard "(001.004)" Standard ROM
*Font Arial-BoldItalicMT: Standard "(001.004)" Standard ROM


3) Convert the fonts from windows truetypefont, ttf to the AFM type by using ttf2pt1 gnuwin32 tool. Do this for Arial if you want to use this font. Rename the AFM, to just the font name. e.g. the file will be ArialUnicodeMS and ArialUnicodeMS.pfa

Open the file and changed the FontName to the correct short font name. In my case is from Arial Unicode MS to ArialUnicodeMS.

Remember to convert the file from windows to unix format. using dos2unix. To find out if the font still is in msdos format try this. od -a arial.ttf grep cr . If there is output then it is still in msdos format.

4) Copy the AFM and the PFA file to the guicommon/tk/admin/AFM folder.


5) We then need to change the uifont.ali, in the guicommon/tk/admin folder. You can set it in the common uifont.ali or make a copy of the file then set it into a new folder e.g. font_test and then set the environment at /reports/conf/opmn.conf under your Ias-Componentss , and the PATH e.g.


variable id="TK_FONTALIAS" value="/ApplTop/product/10.1.2.0/guicommon/tk/admin/Arial"/

In the uifont.ali
Comment out the the item in the #Mapping from MS Windows and # Mapping from Macintosh

Then goto the end of the file, in the [ PDF:Subset ] section add the following. This will add the Arialunicode ms as pdf font subset and also used the Arial as bold and italic format when the report needed.

"Arial Unicode MS"..... = "ARIALUNI.ttf"
"ArialUnicodeMS"..... = "ARIALUNI.ttf"

# Replace normal Arial fonts with the Arial Unicode MS fonts
"arial"...Bold.. ="arialbd.ttf"
"arial"..Italic.Bold.. ="arialbi.ttf"
"arial"..Italic... ="ariali.ttf"
"Arial"..... ="ARIALUNI.ttf"

6) Copy the .ttf fonts to the path that is inside the opmn.conf. variable id="PATH" value=""

7) Changed the guicommon/tk/admin/US/Tk2Motif.rgb. Add this entry after the
!Tk2Motif*fontMapCs: iso8859-2=EE8ISO8859P2
add this k2Motif*fontMapCs: iso8859-1=UTF8

8) Changed the reports.sh in the $ORACLE_HOME/bin folder. changed this
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1; export NLS_LANG
into
NLS_LANG=AMERICAN_AMERICA.UTF8; export NLS_LANG

9) To test the report, after you restart the opmn services
rwrun.sh report= destype=file desname=/tmp/test.pdf desformat=pdf batch=yes userid=test/test@test


Follow the metalink guide, if you need to configure it properly

Note 356221.1: A Practical Methodology on Porting Reports from Windows to Unix with Different Fonts
Note 726205.1: Step By Step To Generate Arabic PDF Reports on Unix
Note 350971.1: Troubleshooting Guide for Font Aliasing / Font Subsetting / Font Embedding Issues
Note 414803.1: How to Display 'Multiple Designed Fonts' in PDF Outputs of Reports Designed Using Multiple Fonts?

No comments: