Contextual components?

Hi all!
I’m working on a typeface that uses quite a few contextual alternates, but the only thing changing is actually the cap component. So I’m wondering if there’s a way to substitute just a component of a character in a specific context, instead of having an alt character? Let’s say if a k is followed by n, I’d like the n to have an alternate cap component.
Could this be achieved somehow?


That is not possible as the cap components are decomposed when exporting the font.

Thought so. Thanks anyways!