You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Redesign Windows Font Download Handler 

Frank Yung-Fong Tang <ftang@netscape.com >

Background

Font Download

One of the biggest issues multilingual Internet users have is lack of font installed on their system to display the text they want to view from the Internet. Internet Explorer version 5 addressed this issue by automatically downloads Text Support package when user visit an html page which encode for those languages. Mozilla also implements similar functionality. This document discusses the design of the current Mozilla font download handling facility, and the redesign for a newer version.

Current Usage of Font Download System

The current Mozilla Font Download System is trigger only on Windows platform. The low level GFX library maintains a set of state for the application. While the Gecko engine try to display a page, it will pass down the language group of the page to the GFX. The GFX will first check to see the system have at least one font to handle such language group or not. If the system do not have a font, which can display such language, then the GFX will trigger a font download service by passing the required language group to it. The font download proxy will find the registered font download handler and pass such request to it. The font download handler will then prompt the user, allow the user to decide download the font or not, and download the font for the users if the user choice to do so. Therefore, the Font Download System is divided into the following components:

  • GFX: The components that know the fonts installed in the Operating System. When it find out it do not have a font for a particular language group but need a font to render the text, it pass such request to Font Download Proxy
  • Font Download Proxy: It will received request from GFX (or some other components later), find a appropriate Font Download Handler and pass such request to it.
  • Font Download Handler: It response to prompt the user a request of download a font package. It then downloads such package for the user if they choose so. 

Currently, we only trigger Font Download Handler on Windows system. The reason that we only trigger it on windows is that we only find out freely download font package for window platform.

Currently, We only trigger for four language groups:

  • Japanese
  • Korean
  • Traditional Chinese
  • Simplified Chinese

The reason that we only trigger for these four language groups is that we only find out freely download package for these languages.

Design of Current XUL Based Font Download Handler

The design of the current XUL Based Font Download Handler is very simply. When a request pass to the font download handler, Mozilla will display a dialog box, which contains a XUL file on the www.mozilla.org server. The URL of the XUL is based on the language group we request to download and the localized language of the UI. The XULs on the www.mozilla.org sites will show the user the name of the font package and the download URL with Install and Cancel button. If the user click Install, then the JavaScript on the XUL will open a URL point to the Global IME which freely download on the Microsoft web site. After the Global IME download to the local disk, user then can install it.

The Problems with the Current XUL Based Font Download Handler

  1. The User Interface of the font download handler is placed on the www.mozilla.org server. If the user  trigger the font download while they are off line then a blank dialog box will show up and user have no way to understand what it mean.
  2. Since we only find four freely download font package, we can only limited this feature for Japanese, Korean, Traditional Chinese, and Simplified Chinese.  We need this same feature for Thai, Arabic, Hebrew, Turkish, and Baltic.
  3. Since the Global IME does not work for Window 2000 and Window XP, we have to turn off such feature for Window 2000 and Window XP 
  4. Since the Global IME package is pack as .exe formation, we cannot automatically install it for the user. Users have to find the .exe file and launch it by themselves after we download to the local disk.
  5. Since the Global IME package require shutdown the system after installation, user need to shutdown and reboot the system to view the page after download the package.
  6. Although the current XUL-based user interface is design for cross platform, the font packages are not. We still need solution for Macintosh and Linux.

Requirements

The redesign and enhancement in this document try to address the 1-5 problems listed in the above section. The problem 6 cannot be addressed by technical solution and required more business resource to resolve them.

  1. The new solution should prompt user properly when they are online or offline, even it won't be able to download the font package while the user is off line.
  2. The new solution should handle the following language group on Windows: Japanese, Korean, Traditional Chinese Simplified Chinese, Hebrew, and Arabic. It is optional to handle other languages
  3. The new solution should work on Windows 95, 98, ME, NT4, 2000, XP. 
  4. The new solution should be able to complete install the font package, without user performs other manual tasks, after user decides to download the package.
  5. The new solution should work without require shutdown the system nor quit the application

Redesign of Font Download Handler

Microsoft claims Internet Explorer is part of the Windows Operating System. We currently know that Internet Explorer, version 5 or greater, has the functionality to download the font package automatically. Therefore we could use such feature in the Windows operating system (as claimed by Microsoft) to handle this issue.

First, we need to find out the file path and version number of the installed Internet Explorer. This information could be found out by looking at the windows registry. If we cannot find out this information or the version is smaller than 5, then we will use the current XUL based font download handler. We can find this information by using the following Registry Entries:

Step 1. Get the IE version number:
Base Key: HKEY_LOCAL_MACHINE:
Key: "Software\\Microsoft\\Internet Explorer\\Version Vector"
Value: "IE"

Step 2. Get the ID CLSID:
Base Key: HKEY_LOCAL_MACHINE:
Key: "Software\\Classes\\InternetExplorer.Applicatoin\\CLSID"
Value: ""

Step 3. Get the IE filepath:
Base Key: HKEY_LOCAL_MACHINE:
Key: "Software\\Classes\\CLSID\\clsid\\LocalServer32"
Value: ""
while the clsid is the value we got from step 2.


Second, we will generate a dummy html page in a temporary file, the temporary file is very simple, it contains a HTML meta tag which encoded with one of the charset in that language group. For example, if the font download proxy requests a Japanese font package, then the font handler should generate a temporary file with charset=Shift_JIS. Below is the table we used to generate such temporary file:


Request Language Group

Japanese

Korean

Traditional Chinese

Simplified Chinese

Arabic

Hebrew

Thai

Baltic

Turkish

value of LangGroup

ja

ko

zh-TW

zh-CN

ar

he

th

x-baltic

tr

Generated value of charset

Shift_JIS

EUC-KR

Big5

GB2312

ISO-8859-6

ISO-8859-8

ISO-8859-11

ISO-8859-3

ISO-8859-9


The generated file will look like the follwing:


 
  

<META HTTP-EQUIV=Content-Type CONTENT="text/html; charset=charset">


Third, we will launch Internet Explorer in the background and ask it to view this generated html page.  Once the Internet Explorer load that generated html page, such Microsoft claimed operating system component would do the job for us. The rest is the magic hide inside such Microsoft claimed operating system component. To create a separate process, we should use Win32 system calls. The font handler could pass a "-k" option in the command with the file URL to ask IE to view the generate html.  The font handler could also hide the IE by using SW_HIDE flag while create the IE process.

Meeting the Requirements

This solution meet all the requirements as long as Internet Explorer version 5 or greater is installed on the system- which is already universal truth for all new shipping Windows system today. The new solution makes this feature the same as what Internet Explorer has today.

Open Issues

  1. The Global IME packages we download not only include font for that language, but it also includes Input Method for that language. However, the font package Internet Explorer will download won't contain such Input Method. 
  2. How could we kill such hidden Internet Explorer process after we finish the download. 

Tracking of Project

See http://bugzilla.mozilla.org/show_bug.cgi?id=92596