sila 
| resources: | Home Mailing List Installation Source Code Bugs Screenshots |
|---|
Project SILA Technical Design Document
Author: Frank Yung-Fong Tang <ytang0648@aol.com> Version: 0.01Purpose of This Document
This document defines the goal, requirements, and dependency of project SILA. This document also discusses the high level architect of project SILA after a high level overview of the Mozilla text processing and display subsystem.Project Goal
To enable minority language communities to publish on the Internet by making Mozilla Internet application suite (Browser, Email , Newsgroups, HTML Composer, Address Book, IRC Chat program) integrated with silgraphite technology to display complex writing system correctly.Project Requirements
- Platform Requirements: Microsoft Windows 2000 and Microsoft Window XP
- Functional Requirements:
- Complex writing system display in
- Browser,
- HTML Editor (Composer),
- Email,
- Newsgroups,
- Address Book, and
- IRC Chat
- Text display
- Only focus on supporting what silgraphite support
-
Left-to-right writing systems (Note: Mozilla all ready support some right-to-left writing systems such as Hebrew and Arabic)
- Language Requirements: The following language data will be used to test SILA
- Burmese
- Burkinafaso (Latin script)
Due to the limit of project time, we decide the following is OUT OF THE SCOPE of this project. We may work on the following issues in the future releases
- Different Operating Systems other than Microsoft Windows 2000 and XP.
- Right-to-left writing systems (Note: Mozilla already support Hebrew & Arabic without silgraphite.)
- Text keyboard input
- Text selection and cursor movement
Project Dependency
This project is heavily depending on the following software
technologies still under development:
- Mozilla- the open source Internet application suite project (www.mozilla.org).
- silgraphite- the open source complex writing system rendering engine (silgraphite.sil.org)
- COM- the component technology on Microsoft Windows: We will use COM to integrate the two technologies above together
Design
This session discuss how we architect project SILA.
Since Mozilla is the foundation of this project, we need to first review
the Mozilla components which handle text processing and display. We will
also briefly review the key features provided by silgraphite. Finally, we
will outline the high level architect of SILA.
Mozilla Text Processing Subsystems Overview
The following components in Mozilla process text information:
- The network library, Necko, receive bytes streams in TCP/IP pockets, block by block.
- Necko pass blocks of byte stream to the HTML parser, XML parser, JavaScript interpreter, or CSS parser depend on the MIME type
- The HTML parser, XML parser, JavaScript interpreter or CSS parser
- find out the text encoding (charset) of the incoming data from meta data, attached label or other sources,
- call appropriate Unicode converter to convert the bytes stream into Unicode text data stream,
- parse the Unicode text data stream into tokens according to the (markup or programming) language lexicon, and then
- The HTML content sink build up content model according to the (markup or programming) language syntax.
- The view system invokes the layout subsystem reflow process to build up the frame model:
- read text data from the content model,
- call the “line breaker” to find out logical (purely depend on the Unicode text data) line break opportunity,
- read style information from the style model,
- call the platform specific GFX (Graphics) subsystem to measure the width of each line break opportunity to decide where to break the line, the size of each frame, and the position of each frame,
- call the platform specific GFX (Graphics) subsystem to display the text according to the associate style and giving position.
- The Window specific GFX (Graphics) subsystem is a very powerful and complex subsystem. Basically, the interface provide 3 main features for the purpose of text display:
- Create a virtual font by information from CSS or user preferences
- Measure the size of a Unicode string by giving a virtual font
- Render the Unicode string by giving a virtual font and screen coordinate
The Design, Features and Architect of Mozilla Text Display Subsystems
Since the goal of SILA project is to render the text of complex writing system on Microsoft Windows, most of (if not all) the integration points are reside the Windows specific GFX (Graphics) subsystem. We review the design of this component in details in this session. The ultimate text display code is inside the Windows specific GFX subsystem. We will only discuss the part which related to virtual font, text measuring and text rendering.Each virtual font in the Mozilla GFX subsystem is a defined order to accessing (if necessary) all the installed font to measure or render a giving Unicode string. The order is depend on:
- The given CSS font-family property, or HTML <font> face attribute of that node or it’s inherited value
- The per-language group font preference value, selecting by the source charset (text encoding) of the document, and the CSS generic font-family name
- Other font preference value in the same language group
- Font preference value of other language group
- The rest of the installed font
In summary, the real font(s) used by the Mozilla for a given text node is mainly control by the following three factors:
- The font-family property in CSS
- The Unicode code points
- The ‘CMAP’ table of the font
Key Features provided by silgraphite
silgraphite help Window base application to render text in complex writing systems by reading data from graphite enabled TTF fonts.silgraphite read the additional Graphics specific TrueType table and analysis the given Unicode text to perform text measuring and rendering of complex writing system. Please see the silgraphite documentation for details. We will not discuss them in this session.
In order to work with silgraphite, the calling software needs to implement two helper classes. The first one implements the IGrTextSrc interface to maintain the text data. The second class implements the IGrGraphics interface to read TrueType font table and call operating system to measure/render the “glyphs” (not the “characters”).
The calling software should create a GrEngine for a specific font. It should associate an IGrGraphics to the GrEngine when initialize the GrEngine. It then passed Unicode string to the FindBreakPoint method of the GrEngine object to create one ore more IGrSegment. Then it calls the measurement and rendering method of the IGrSegment. These methods will call the methods implemented in the IGrGraphics to interact with the operating system.
High Level Architect of SILA
In order to integrate the silgraphite into Mozilla,
we need to address the following architect issues first:
- WHEN should Mozilla call silgraphite
- HOW should Mozilla call silgraphite
WHEN to call silgraphite?
To answer the first question, we first need to look
into the graphite enabled font. A graphite enable font is really just a standard
TrueType font (possible also OpenType or AAT) with additional Graphite specific
table. The ‘CMAP’ of the graphite enable font follow the same rule as standard
TrueType font. Therefore, we can share the same ‘CMAP’ exams code with other
TrueType fonts. Mozilla should call the silgraphite only when it try to use
the graphite enable font to measure or render Unicode text which covered
by it.
Since every graphite enable font includes a ‘Silf’ table, we can distinguish a graphite enable font by check the existence of this table in the TrueType font directory. If a font includes such TrueType table, then we will call silgraphite to perform the text measurement or rendering.
Since every graphite enable font includes a ‘Silf’ table, we can distinguish a graphite enable font by check the existence of this table in the TrueType font directory. If a font includes such TrueType table, then we will call silgraphite to perform the text measurement or rendering.
HOW to call silgraphite
To reduce the maintain cost and reduce the need to use
most of the code across different version of Mozilla, we define a generic
COM based interface to separate the silgraphite specific code from the Mozilla
specific code. The part which implements the silgraphite specific part will
be implement in a COM based DLL, currently named mg2.dll (Mozilla Graphite
Together). This DLL include a static linked silgraphite library of a stable
version. It hides all the details of how to work with the silgraphite APIs.
The Mozilla code will be change to call such generic COM interface. And
the Mozilla patch implement all the details of how to work under the Mozilla
GFX virtual font look up and text measurement/rendering subsystem.
- Project SILA
- ISpecialTTFFont.h: A COM interface definition which measure / render text
- Mozilla
- GFX
- Patch to call the ISpecialTTFFont COM interface when measure / render text if it is a graphite enable font
- Xpinstall
- Patch to include mg2.dll into the installer, install the mg2.dll, which including register mg2.dll to the registry for COM, in the installation process
- Mg2.dll
- Silgraphite: a stable version of silgraphite library static linked into this dll
- silFont: Class which implement the defined ISpecialTTFFont COM interface by using GrGraphics, GrTextSrc and calling silgraphite
- Registry: Code to perform COM DLL self registry
- GrTextSrc: Helper class implements IGrTextSrc
- GrGraphics: Helper class implements IGrGraphics
How to Generate Contents Work Nicely with SILA
To make contents (HTML) work nicely with SILA, we need
to
- Clearly specify the font name in the CSS font-family property, this is essential to work with Latin base graphite enable fonts or text in Unicode block which non graphite enable font may cover those characters in the ‘CMAP’.
- Use correct and appropriate Unicode code points. Either use UTF-8 to encode the document, or use text encoding neutral escaping mechanism in each languages to specify the Unicode code point.
Project Risks & Solution
- Stability of Mozilla: Since this project heavily depends on Mozilla, the status of the Mozilla project is the biggest risk of this project. To address this, we decide the following:
- Base the Mozilla 1.0 branch (which Netscape 7, Netscape 7.01, Netscape 7.02 based on) to produce the Alpha build
- Base on the Mozilla 1.4 branch (which Netscape 7.1 based on) to produce the Beta 2 build.
- Stability of silgraphite: The bugs and stability of silgraphite also greatly impact this project. In order to reduce the risk, we decide to static link the silgraphite library into the mg2.dll. The version of the silgraphite will base on the addressed issues in the silgraphite source, number of changes around the date and trial testing result.
Project Release Plan
Based on the status of the project, we release the binary
in the following format:
- Patched gkgfxwin.dll + mg.dll in zip file: We release Alpha build by include a modified gkgfxwin.dll based on the same branch of Netscape7.0 (or Mozilla 1.0) and mg2.dll. In order to use it, the user have to first download the Netscape 7.0 (or Mozilla 1.0) separately, download the package to replace the gkgfxwin.dll manually, and call the COM registry program come with Windows to register the mg2.dll.
- Mozilla files + mg2.dll + setup.bat in zip file: We release in this way in Beta cycle until we finish the required installer changes. This require the user to download the patched Mozilla in a zip file and run a setup.bat batch program after unzip the zip to install.
- Mozilla installer include everything: This is the ideal way to release Project SILA. We should ship Beta 2 in this method. This requires installer changes in addition to the run time GFX, silgraphite integration. The user will use the installer exactly the same way they use the Mozilla installer.