Platform Independent Tibetan Unicode Font: Difference between revisions

From Rangjung Yeshe Wiki - Dharma Dictionary
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==Overview==
earth, water, fire, and wind.
 
In order for Unicode to be truly platform independent, Unicode [[Tibetan Fonts]] should work on all platforms (Linux, Windows, Mac OS-X) and Unicode documents should be fully exchangeable between them, either as Unicode text document or as Unicode RTF document.
 
Exchange between Linux and Windows using [http://www.openoffice.org/ OpenOffice] works very well, since both platforms support OpenType features required to display complex scripts and OpenType fonts as for example [http://www.thdl.org/tools/fonts/tibfonts.php?l=uva10928423419921 Tibetan Machine Uni]. See also [[Tibetan Unicode Installation]].
 
Unfortunately Mac OS-X up to the very recent versions does not support the required OpenType functionality to correctly render Tibetan stacks. However, with Mac OS-X 10.4.8 Apple introduced at least some support for ligatures, a key feature in order to display Tibetan stacks - but they support a different subset of OpenType's many ways to support ligatures than Linux and Windows...
 
==How to create a platform independent Unicode font==
It is possible by only using the 'ligatures' feature out of OpenType's many powerful features to create fonts that work with Windows, Mac and Linux.
 
Indic scripts and Tibetan create stacks by using the OpenType feature 'Below base substitution ligatures' (blws). The font contains the image of a Tibetan stack ('a glyph') together with a definition which letters do compose this stack. A Unicode font would for example contain an image of the glyph ''rgyu'' together with a ligature definition how this glyph is composed of single letters. A very good description how to encode Unicode stacks can be found [http://www.thdl.org/xml/showEssay.php?xml=/tools/encodingTib.xml&m=all at THDL].
 
In case of Linux/Windows fonts, this ligature glyph for ''rgyu'' would be identified by the OpenType feature 'BLWS ligature', a 'below base substitution ligature' that is used in OpenType for Tibetan or Indic scripts. This way, the font actually has the knowledge how to display a Tibetan stack and how to render the sequence ''rgyu''.
 
Unfortunately Mac OS-X (up to version 10.4.8) currently does not support BLWS ligatures, however a different type of ligatures, 'RLIG', 'required ligatures' are support - of course those are not supported with Windows/Linux in Tibetan scripts.
 
So for Mac either a second version of the Font file has to be created since Macs do not understand 'BLWS ligatures' but requires a RLIG (required ligature) tag, or two tags (both a BLWS and a RLIG tag) can be applied to one glyph.
 
==Using FontForge to create Tibetan fonts==
 
===Installing FontForge and creating Fonts===
A very powerfull font editing program, available for Mac, Windows and Linux and free, is [http://fontforge.sourceforge.net/ FontForge]. FontForge can open, edit, and write a large number  of font formats.
To install FontForge (Windows) follow: http://fontforge.sourceforge.net/ms-install.html
 
Instructions for other operating systems can be found at http://fontforge.sourceforge.net
 
===Editing Tibetan fonts and creating Sanskrit stacks for existing fonts===
To convert an existing Tibetan font, load the font into FontForge and create a new empty font. Use the THDL [http://www.thdl.org/tools/fonts/tibfonts.php?l=uva10928423419921 Tibetan Machine Uni] font as an example if you in doubt about settings.
Name your font using "Element / font info".
===Standard range Tibetan 0x0f00 - 0x0fff===
Get a definition of the Tibetan Unicode font range (characters 0x0F00 to 0x0FFF) and copy the standard characters from your existing font into the standard range. You can simply load [http://www.thdl.org/tools/fonts/tibfonts.php?l=uva10928423419921 Tibetan Machine Uni] into FontForge and take this as reference to see which character is expected where in the range of 0x0f00 to 0x0fff. Note that only a few stacks are within the standard range. Stacks are handled differently.
 
Since Unicode knows that Tibetan fonts are aligned at the upper border of a character, you need to move the characters upwards. Select them and your Transform/move to adjust the zero line. Again it is a good idea to use [http://www.thdl.org/tools/fonts/tibfonts.php?l=uva10928423419921 Tibetan Machine Uni] as an example.
===Tibetan Stacks===
Tibetan Stacks are implemented as ligatures. The Unicode sequence for ''rgyu'' is defined as a ligature-glyph that represents the corresponding stack. This way the font itself has all the knowledge how to represent those stacks. In the example of ''rgyu'', the Unicode encoding is: uni0F62 (ra from upper half of unicode area 0F00-0FFFF), uni0F92 (ga and all following letters from lower half, since they are subjoined letters to ra), uni0FB1 (yata), uni0F74 (vowel marker for u). Note that Unicode does not know about root letters in Tibetan alphabet. The encoding always marks the uppermost letter (not including vowel signs, nadas and so on) by encoding it from the Unicode range of 0F40-0F79 and all lower letters of a stack ('subjoined') are encoded from range 0F90-0FBC. See [http://www.thdl.org/xml/showEssay.php?xml=/tools/encodingTib.xml&m=all  THDL] for a very good description on how to compose Tibetan Unicode glyphs.
 
To create a stack, in FontForge create a new encoding slot ('Encoding / Add Encoding Slot') and copy the graphical representation of a stack into that new slot. Note that this slot does not have a standard Unicode ID. At this point there would be no way for any computer program to actually use the stack. In order to make the stack known, we need to define a ligature: Select a stack and select 'Element / Glyph Info'. Now select 'OT Glyph class' = Base Lig. Then select ligatures on the left and create a 'New' ligature. You need to enter the Unicode Values of the stack components: the first letter of a stack is from the upper half of the Unicode range, all following ('subjoined') letters are from the second range. See [http://www.thdl.org/xml/showEssay.php?xml=/tools/encodingTib.xml&m=all THDL] for detailed explanation. Select as Tag: 'Below base substitution' blws and select 'Ignore combining marks'.
 
To create a Mac OS 10.4.8 compatible font, you would either only or additionally create a rlig ligature entry. Fontforge supports more than one ligature entry per glyph.
 
FontForge also has a useful function to replace all BLWS tags by RLIG tags. (See FontForge 'Typographic features'). This can be used to easily convert fonts that were created for only one of the platforms.
 
At this point you should have a font that can be used for a first test:
 
Save your work in FontForge, then select 'File / Generate Font' and generate a TrueType or OpenType font (both seem to work for Windows). Create 'OpenType' for Mac. Drag the font into control panel / fonts and launch a Unicode aware application (e.g. notepad, OpenOffice, Microsoft Word) to test your new font. Use TextEdit for Mac OS-X 10.4.8 and above.

Revision as of 09:06, 7 September 2007

earth, water, fire, and wind.