TLDR; research and development of a completely new OpenType layout rules for Malayalam traditional orthography.
Writing OpenType shaping rules is hard. Writing OpenType shaping rules for advanced (complex) scripts is harder. Writing OpenType shaping rules without causing any undesired ligature formations is even harder.
Background
The shaping rules for SMC fonts abiding v2 of Malayalam OpenType specification (mlm2
script tag) were written and polished in large part by me over many years, fixing shaping errors and undesired ligature formations. It still left some hard to fix bugs. Driven by the desire to fix such difficult bugs in RIT fonts and the copyright fiasco, I have set out to write a simplified OpenType shaping rules for Malayalam from scratch. Two major references helped in that quest: (1) a radically different approach I have tried few years ago but failed with mlym
script tag (aka Windows XP era shaping); (2) a manuscript by R. Chithrajakumar of Rachana Aksharavedi who culled and compiled the ‘definitive character set’ for Malayalam script. The idea of ‘definitive character set’ is that it contains all the valid characters in a script and it doesn’t contain any (invalid) characters not in the script. By the definition; I wanted to create the new shaping rules in such a way that it does not generate any invalid characters (for e.g. with a detached u-kar). In short: it shouldn’t be possible to accidentally generate broken reformed orthography forms.

“Simplify, simplify, simplify!”
Henry David Thoreau
It is my opinion that a lot of complexity in the Malayalam shaping comes from Indic OpenType shaping specification largely following Devanagari, which in turn was adapted from ISCII, which has (in my limited understanding) its root in component-wise metal type design of ligature glyphs. Many half
, postbase
and other shaping rules have their lineage there. I have also heard similar concerns about complexity expressed by others, including Behdad Esfahbod, FreeFont maintainer et al.
Implementation
As K.H. Hussain once rightly noted, the shaping rules were creating many undesired/unnecessary ligature glyphs by default, and additional shaping rules (complex contextual lookups) are written to avoid/undo those. A better, alternate approach would be: simply don’t generate undesired ligatures in the first place.
“Invert, always invert.”
Carl Gustav Jacob Jacobi
Around December 2019, I set out to write a definitive set of OpenType shaping rules for traditional script set of Malayalam. Instead of relying on many different lookup types such as pref
, pstf
, blwf
, pres
, psts
and myriad of complex contextual substitutions, the only type of lookup required was akhn
— because the definitive character set contains all ligatures of Malayalm and those glyphs are designed in the font as a single glyph — no component based design.
The draft rules were written in tandem with RIT-Rachana redesign effort and tested against different shaping engines such as HarfBuzz, Allsorts, XeTeX, LuaHBTeX and DirectWrite/Uniscribe for Windows. Windows, being Windows (also being maintainers of OpenType specification), indeed did not work as expected adhering to the specification. Windows implementation clearly special cased the pstf
forms of യ (Ya, 0D2F
) and വ (Va, 0D35
) [update Mar-2023: both Uniscribe & HarfBuzz are right to insist pstf
form for ya/va signs, as they do not conjoin with base glyph and to reorder left-matras such as െ etc. correctly *before* the base glyph, akhn
cannot work]. To make single set of shaping rules work with all these shaping engines, the draft rules were slightly amended, et voila — it worked in all applications and OSen that use any of these shaping engines. It was decided to drop support for mlym
script which was deprecated many years ago and support only mlm2
specification which fixed many irreparable shortcomings of mlym
. One notable shaping engine which doesn’t work with these rules is Adobe text engine (Lipika?), but they have recently switched to HarfBuzz. That covers all major typesetting applications.





Testing fonts developed using this new set of shaping rules for Malayalam indeed showed that they do not generate any undesired ligatures in the first place. In addition, compared to the previous shaping rules, it gets rid of 70+ lines of complex contextual substitutions and other rules, while remaining easy to read and maintain.

Application support
This new set of OpenType layout rules for Malayalam is tested to work 100% with following shaping engines:
- HarfBuzz
- Allsorts
- DirectWrite/Uniscribe (Windows shaping engine)
And GUI toolkits/applications:
- Qt (KDE applications)
- Pango/GTK (GNOME applications)
- LibreOffice
- Microsoft Office
- XeTeX
- LuaHBTeX
- Emacs
- Adobe InDesign (with HarfBuzz shaping engine)
- Adobe Photoshop
- Firefox, Chrome/Chromium, Edge browsers
Advantages
In addition, the advantages of the new shaping rules are:
- Adheres to the concept of ‘definitive character set’ of the language/script completely. Generate all valid conjunct characters and do not generate any invalid conjunct character.
- Same set of rules work fine without adjustments/reprogramming for ‘limited character set’ fonts. The ‘limited character set’ may not contain conjunct characters as extensive in the ‘definitive character set’; yet it would always have characters with reph and u/uu-kars formed correctly.
- Reduced complexity and maintenance (no complex contextual lookups, reverse chaining etc.). Write once, use in any fonts.
- Open source, libre software.
This new OpenType shaping rules program was released to public along with RIT Rachana few months ago, and also used in all other fonts developed by RIT. It is licensed under Open Font License for anyone to use and integrate into their fonts, please ensure the copyright statements are preserved. The shaping rules are maintained at RIT GitLab repository. Please create an issue in the tracker if you find any bugs; or send a merge request if any improvement is made.