I got stuck on a detail that is possibly trivial and covered in some sort of 'OpenType 101,' but I have never seen anything similar in the specifications.
I'm trying to set up a ccmp feature in a Unicode-mapped font that would work with CJK glyphs (ccmp apparently doesn't matter; what matters is I am making a many-to-one substitution). It works as a breeze when I combine two glyphs Unicode-mapped to ASCII symbols (Latin letters) [obviously: how come would 'fi' combine to ligature otherwise], or two CJK glyphs, or a Latin letter and a PUA glyph etc.
However, my usercase demands to setup a substituton
sub glyph_1 glyph_2 -> glyph_3;, where glyph_1 is Unicode-mapped to a Latin letter and glyph_2 to a CJK glyph. And I found out it immediately stops working. The opposite order does the same. After experimentation I even found out digit+CJK is OK, but Cyrillic letter+CJK is not. Literally, just adding a bonus PUA mapping (without deleting the Unicode one) to the same CJK glyph_2 leads to the case when if I input these two glyphs using PUA code for the second, they immediately combine, but when I use the Unicode one (the very same CID being internally!), composition breaks. I tried any combinations of languages and scripts, and couldn't make it work even in default language with default script; furthermore, even codepoints for full-width Latin letters instead of Latin letters destroy composition.
Is it some sort of failsafe introduced to OpenType standard in order to defend from script-mixing producing unwelcome results - and how come it is not mentioned elsewhere?
How do I trick the font, if it's possible, and still make the substitution of Latin letter+CJK? I don't want to force users to type, say, a digit instead of a letter or to paste a combining zero-width joiner etc.
Anyway: how come the workings of font would depend on where exactly glyphs are mapped to Unicode?