to install an old orthography Malayalam Unicode font which is required to read the posts below]
Shaping behaviour of ZWJ and ZWNJ (let me call them collectively as ZW operator for remaining of the document) in the context of Malayalam:
It forces a shaping engine to take shaping decision before the logical boundary is reached. Characters are read from left to right. ZW operator can have one or two operands to its left.
If ZW operator sees only one operand then outcome is trival - it is the original form of the letter.
If ZWJ sees two operands to its left, then output their ligature form or fallback. If they are consonant+virama, it will be the half form or chillu form of the consonant.
If ZWNJ sees two operands to its left, output their non-joined form.
The output of a ZW operation will not change shape in further shaping decisions. The resultant will be considered as a single operand for those operations.
When a shaping engine gets operand X + virama + operand Y, then it will output the single ligature for X and Y or use the fallbacks:
1. full form of X and sign or subscript form of Y
2. non-joined form with visible virama.
When a shaping engine gets virama + operand X, then the sign form or subscript form of operand X is outputted.
Above summary assumes, there is only one subscript and sign form for a letter. Similar assumption is there about chillu and half forms of a letter.
Antoine notes:
"Badly (that is the whole point of my critic against the use of ZWJ to mean semi-open ligature instead of more closed ligature). For example, the typical example for ZWNJ/ZWJ is Nagari K.KA क्क. The body of the standard explains how to force the overt virama form with
क्क, or the linear form with क्क. But how do you "force" the stacked form (shown in the body of the standard),
particularly when one notes that in today's Devanagari, the linear form क्क is the "preferred", among other at small resolutions or for UI fonts like Mangal?"
There is at least one scenario where a letter has two different sign-subscript forms in Malayalam. It is for VA in the context of LLLA(zha) and YA.
Finding a way to write them separately will require more than the modification/addition of a format character because of the same old argument - a spell checker ignores format characters.