Tuesday, November 07, 2006

Fonts in Web Forms

How to control fonts in web form?:

There are 2 relevent config files:
1. \forms\java\oracle\forms\registry\Registry.dat
server side file - no deployment problems
2. C:\Program Files\Oracle\JInitiator 1.3.1.22\lib\font.properties
client side file - instaled with the JInitiator and we will need to distribute the new file to the clients

The first file map font names from the forms application to java forn name:
default.fontMap.appFontnames=Courier New,Courier,courier,System......
default.fontMap.javaFontnames=MonoSpaced,MonoSpaced,Dialog,Serif.....

so that courier new will become monospace in the web application
and Courier =MonoSpaced
courier = Dialog
System = Serif
and so on.

If there is a font in the form that we want to change to another font then we need to add the font name and the java font name to the list.

Default Java fonts (case sensitive):
Monospaced (fixed length fonts)
Dialog
Serif
SansSerif

Now the second file: font.properties OR font.properties. (depends on the client's "regional setings")

In this file the first part maps jave font names to local font names.

For each java font there is maping to a local font with all different situations he might face (bold, Italic..).

e.g.
dialog.plain.0=Arial,DEFAULT_CHARSET
Dialog Java font will become Arial at the local machine.

monospaced.plain.0=Courier New,DEFAULT_CHARSET
MonoSpaced Java font will become Courier New at the local machine.


Later in this file we need to define where to find those fonts on the client:
filename.Arial=ARIAL.TTF
filename.Courier_New=COUR.TTF

Now the only problem is how to distribute this files to all client (hint - we use the JInitiator installation for it).
This will be coverd in a different post.

Cheers



No comments: