I am facing a problem in cursive attachment in an arabic font. I apply mark positioning on a certain character but when I join this character with other words by cursive attachment the marks remain on their previous level.

For example I made a "yehfinal" and adjusted marks on it. When this yehfinal remain at its level then the marks appear at right places as shown in first word on the right side of the image. But when I attach this yehfinal with other characters (above or below yehfinal's original level) through cursive attachment, the character yehfinal appears at the required adjusted level but the marks remain at their previous level and as a result collide with characters as shown in the second word on the left. In the image it is clear that the yehfinal in the second word (on left side) is a little lower than the first word (on right side) and as a result the marks collide with Ijam.
Is there a way to solve this problem? i.e. the mark position changes according to the glyph level.