Change glyph when change text orientation

In Chinese, there are punctuation designed for vertical or horizontal text line, for example “【】” for horizontal text and " ︻︼" for vertical.

But it will have a problem that when I change the text orientation in application (i.e. Illustrator), the punctuation will in wrong orientation.

Are there any way to do it in opentype to automation change to the right glyph according the text orientation? Any feature, script or something else!


Is it working correctly when you use a different fonts?
I think you need some OpenType features. Or set up the vertical typesetting and language settings.

It work correct on other Chinese font, they change suitable glyph when change text orientation, so it must have a way in opentype to do it

I guess you want vertical alternates.