Introduction

This page indexes a set of utilities for reading and writing Tai Tham.

Fonts

Da Lekh Font Family

The Da Lekh font is a stick font based on Deja vu Sans intended to be suitable for use in preparing (but perhaps not publishing) Tai Tham text. It therefore includes work-arounds for known rendering engine problems. The Da Lekh Seri font is a cut-down version which deliberately does not include such work-arounds.

Font Peculiarities

Traditionally, the consonants used in neither Pali nor Sanskrit did not have subscript forms. However, one significant text book, the 'big blue book', provides a subscript form for LOW FA for use in loans from English. However, this form is cramped and ugly, which goes against the tradition of Lanna script writing. The MFL treats the stroke distinguishing HIGH KXA, LOW KXA, LOW SA, LOW FA and LETTER UU from HIGH KHA, LOW KA, LOW CA, LOW PA and LETTER U as a diacritic. The Da Lekh font follows this interpretation, and leaves this diacritic above the baseline when the letter is subscripted.

If you have difficulty reading the Da Lekh fonts, you may find it useful to consult their glyph gallery.

Access and Use

You may freely use my four fonts mentioned here without modification and may freely examine my fonts. See the respective licensing for conditions and modification. I do not own all the intellectual property rights for the Da Lekh and Da Lekh Si fonts. The fonts are available as follows:

NameFont fileSource file Licence file
Da Lekh
(ᨯᩣᩃᩮ᩠ᨡ)
dalekh.ttf File dalekh.txt in dalekh.zip. This is also the ultimate source code for the Da Lekh Seri font. See Makefile therein for preprocessing directives. DejaVu licence
Da Lekh Si
(ᨯᩣᩃᩮ᩠ᨡᩈᩦ)
dalekh_si.ttf
Da Lekh Seri
(ᨯᩣᩃᩮ᩠ᨡᩈᩮᩁᩥ)
dalekh_seri.ttf Either start from the source code, which is subject to the DejaVu licence, for the Da Lekh font, or use the preprocessed file dalekh_seri.txt. If the GNU Compiler Collection is available, one may use the following command to generate the immediate 'source' code:
cc -E -fdirectives-only -DSERI -x c dalekh.txt | grep -v ^# >| dalekh_seri.txt
seri_license.htm
Da Lekh Si Seri
(ᨯᩣᩃᩮ᩠ᨡᩈᩦᩈᩮᩁᩥ)
dalekh_si_seri.ttf Either start from the source code, which is subject to the DejaVu licence, for the Da Lekh font, or use the preprocessed file dalekh_si_seri.txt. If the GNU Compiler Collection is available, one may use the following command to generate the immediate 'source' code:
cc -E -fdirectives-only -DSERI -DCOLOUR -x c dalekh.txt | grep -v ^# >| dalekh_seri.txt

If you wish to have WOFF files, you should either generate them yourself from the font file listed above, or simply copy them from this website.

The fonts are generated from the source code by means of an unpublished, DIY font compiler that still has many rough edges. However, the source code of the font, although spartanly commented, may make it clearer what the font is attempting to do. I have endeavoured to make reverse engineering unnecessary.

The font Da Lekh is partly intended for my practical use in analysing material in the Tai Tham script. It therefore contains a large set of Latin characters to support transcription and transliteration. It also contains work arounds so that it may render properly despite problems with rendering engines.

The other purpose of the fonts is to explore issues in making an OpenType font for the Tai Tham script.

The font Da Lekh Seri is an unencumbered font intended for testing rendering engines. It therefore has, besides the glyphs for Tai Tham writing systems, just a bespoke set of (poor) ASCII glyphs and both the extra characters required by Microsoft Office and the characters recommended for the Universal Script Engine. Known existing work-arounds have been removed. This removal is implemented by compiler directives.

The font Da Lekh Si (ᨯᩣᩃᩮ᩠ᨡᩈᩦ) differs from Da Lekh in that it aims to reveal the spelling of words. This is useful when using a spell-checker, for example on Firefox. The ideal is that subscript consonants in the coda of an orthographic syllable would be distinguished from those in the onset by colour, whence the word 'Si' in the name of the font. Note that of the major browsers, the colour technology used currently works only in Firefox and Microsoft Edge. The colouring is also applied to chained syllables, except that this has not yet been applied to chained syllables.

It is possible that Da Lekh Si may be reduced to an optional OpenType feature applied to the Da Lekh font.

The font Da Lekh Si Seri is an unencumbered font without work-arounds for problems with renderers. It is intended as an aid for the development of the Da Lekh Si font.

Lamphun Font

The Lamphun font is a development of the Hariphunchai font. The Hariphunchai font is an OpenType Layout font that looked promising when used with the South-East Asian shaper of HarfBuzz. Development seems to have stopped when HarfBuzz switched Tai Tham to its implementation of the Universal Shaping Engine (USE). The code for this font is available on SourceForge and there is further documentation elsewhere. I have added work-arounds and a few further touches to enable it to work under the USE; the Lamphun font is the resulting font.

The Lamphun font is available under the SIL open font licence; the applicable customisation declares that "Hariphunchai" and "Lamphun" are reserved font names. The font file is lamphun.otf and what I have used as 'source' code to build the font is an untidy mess assembled in lamphun.zip:

RôleNameRemarks
GlyphsHariphunchai.otf

A version of the font dated 5 May 2014, taken from SourceForge. It is stamped as Version 001.000, but that probably means nothing. There are later .sfd and .fea files at the same location, but at best they may offer improved glyphs compared to Lamphun.

This is the file that defines the Hariphunchai font as used on this web page.

OTL tableslamphun.txt

This defines a font with the same glyph numbering, but with blank glyphs. I then replace 7 tables in the Hariphunchai font with tables from this new font:

NameReason
name
Rename font to comply with the licence, and record appropriate licensing and history information.
GSUB
Include lookups to undo rendering damage by the USE. Position medial ra using feature pref. Move other lookups from ccmp to blws, so that they are applied when missyllabification by USE is no longer an issue. Choose appropriate glyphs when there are level 2 subscripts with vocalic function. Handle mai kam, subscript consonants on NYA, and N.WAA and N.HAA.
GPOS
Add some mark-to-mark positioning. Use dist to restore advance widths of spacing subscripts.
GDEF
Correct a few glyph categorisations.
cmap
Add mappings for control characters so that rendering engine damage can be repaired.
OS/2
Allow more complex OTL operations. Declare greater line depth to enable more rapid rendering. Blanked vendor ID.
head
Change font revision and modification time.
Change logfontlog.txtOnly for Lamphun.
Make filelamphun_makefile Provided for completeness - it is of little use without my font compiler, but is a complete record of the path from my sources to the font.

It is likely that I will create a variant coloured to indicate spelling.

Font Support

Package

The files for font support and typing the Tai Tham script are included in the file lanna_user_tools.zip. The font support tools are:

MechanismFiles
FontConfig 99-lanna.conf Notes
Emacs tai-tham.el Notes
M17n LANA-OTF.flt Notes

Notes on FontConfig

Font Confix is a Linux utility for managing fonts. To use the file, 99-lanna.conf should be copied to ~/.config/fontconfig/conf.d for a single user's use, or to /etc/fonts/conf.d for use by all users.

The file contains scaling commands for a font gr3Lannawww. If you do not have such a font, you should remove the corresponding section.

The rest of the file sets up Da Lekh Si as the default font for the Tai Tham script. Ubuntu use a non-existent default font "Ubuntu", which then falls back to the preferred fonts. For non-Ubuntu systems, you will need to change the name to something else. It also makes it the preferred font for the Tham script in the monospace, sans and serif font 'families'. To prevent it becoming the preferred font for the Latin script, prior preferences are set up for the Deja Vu Sans Mono, Deja Vu Sans and Deja Vu Serif families.

Notes on M17n

The Emacs editor uses the M17n layout capability to render complex scripts.

The M17n layout capability does not directly include script-specific layout engines. Instead, the layout rules are included as lisp-like text files in the M17N database. They may be script-specific or script- and font-specific. The file LANA-OTF.flt is a contribution that is intended to be generally suitable for fonts that use OpenType layout. It is known to work with the Da Lekh font.

If M17n is installed, the location of the database is given by running the command m17n-db. The environment variable M17NDIR may be used to define a private version of the library.

When using the M17n layout capability, Emacs has the responsibility of grouping Indic text into syllables, or a good enough approximation for the shaping rules. The required defintions are in the file tai-tham.el. They are activated by having a line such as

  (load-file "~/tham/tai-tham.el")

in the startup file .emacs. This example assumes that the file is held in directory ~/tham. It is more natural to keep this file in a subdirectory of ~/.emacs.d.

The Tai Tham font for Emacs to use is specified by modifying the default font thus:

  (set-fontset-font "fontset-default" '(#x1a20 . #x1aad) "Da Lekh")

Keyboards

Keyboard Map

The keyboard map is a goal; not all the keyboard implementations and documentation are currently consistent. Additionally, several of the keyboard implementation are incapable of providing the general functionality. The keyboard is based on the Thai kesmanee keyboard; it may be useful to use a commercially available Thai keyboard as the physical keyboard.

Package

The files for font support and typing the Tai Tham script are included in the file lanna_user_tools.zip. The keyboard input tools are:

MechanismFiles
XthNotes
KMFL lanna3.kmn lanna.png Notes
M17n nod-kesmanee.mim nod-kesmanee.png Notes
MSKLC kbdlanna.klc setup.exe
kbdlann3_i386.msi kbdlann3_amd64.msi kbdlann3_ia64.msi
kbdlann3.dll (4 versions)
Notes
Emacs lanna.el Notes

Notes on X Keyboard

The X keyboard is provided as an addition to the Thai keyboards. The addition is called "Thai (Tham Kesmanee)" and has name "tham". The file th is a replacement for the file /usr/share/X11/xkb/symbols/th.

The file /usr/share/X11/xkb/rules/evdev.xml needs to be modified to include the declaration

    <variant>
      <configItem>
        <name>tham</name>
        <description>Tham Kesmanee</description>
      </configItem>
    </variant>

next to the entries for variants named tis and pat.

Notes on KMFL Keyboard

The Keyboard Mapping for Linux keyboard is provided as the text file lanna3.kmn; the associated icon file is lanna.png. Note that there has been some inconsistency in the naming of the directory for the icon files between icon and icons. One solution is to make one of the names a symbolic link to the other.

Notes on M17n Keyboard

The M17n utilty referred to above may also be used to define keyboards. It is accessed via bridging methods from the ibus and fcitx input methods. The keyboard definition file is nod-kesmanee.mim and goes in the data base directory. The icon file is nod-kesmanee.png and goes in its icons directory. There may be a fault in the set-up of the icon; it is not displayed when the fcitx input method is used. The icon file is identical to the one for KMFL.

The AltGr modifier does not work with fcitx. This bug can be fixed by changing the fcitx code; see Modifier Keys for fcitx-ma17n? for details.

Notes on MSKLC Keyboard

The keyboard files for Windows are stored in directory kbdlann3. They are installed by running kbdlann3/setup.exe with administrator privilege. They are created using the Microsoft Keyboard Layout Creator (MSKLC). The master file is the UTF-16 text file kbdlann3/kbdlanna.klc. Note that the format is pernickety and undocumented; it should only be edited using the MSKLC.

Notes on Emacs Keyboard

As it is traditional to define Emacs keyboards at system level in the subdirectory lisp/leim/quail, private Emacs keyboards are naturally gathered together in the directory .emacs.d/quail. If such a convention is used, the keyboard is then loaded into Emacs by the following line in .emacs:

(load "~/.emacs.d/quail/lanna" nil nil nil t)

References

Short NameFull Reference
MFL Rungrueangsi, Udom (2004) [1991]. Lanna-Thai Dictionary, Princess Mother Version พจนานุกรมล้านนา ~ ไทย ฉบับแม่ฟ้าหลวง ᨻᨧᨶᩣᨶᩩᨠᩕᩫ᩠ᨾᩃ᩶ᩣ᩠ᨶᨶᩣ ~ ᨴᩱ᩠ᨿ ᨨᨷᩢ᩠ᨷᨾᩯ᩵ᨼ᩶ᩣᩉᩖ᩠ᩅᨦ [Photchananukrom Lanna ~ Thai, Chabap Maefa Luang] (in Thai) (Revision 1 ed.). Chiang Mai: Rongphim Ming Mueang (โรงพิมพ์มิ่งเมือง). ISBN 974-8359-03-4.
big blue book Wacharasat, Bunkhit (2003). Language of Mueang Lanna ᨽᩣᩈᩣᨾᩮᩬᩨᨦᩃ᩶ᩣ᩠ᨶᨶᩣ ภาษาเมืองล้านนา [Phasa Mueang Lanna] (in Thai). ISBN 974-85472-0-5