How do you make vertical (with left-to-right line wrapping) Mongolian script TextViews for Android apps?
Background
Android has fairly good support for many of the world's languages, even RTL languages like Arabic and Hebrew. However, there is no built in support for top-to-bottom languages like traditional Mongolian (which is still very much alive in Inner Mongolia and not to be confused with Cyrillic Mongolian). The following graphic shows the text direction with English added for clarity.
Since this functionality is not built into Android, it makes almost every single aspect of app development extremely difficult. There is also very, very little information available online. (One of the few related SO questions does not even have a good answer.) There are a number of app developers for traditional Mongolian, but whether it is for commercial reasons or otherwise, they do not seem to make their code open source.
Because of these difficulties I would like to make a series of StackOverflow questions that can serve as a central place to collect answers for some of the more difficult programming problems related to traditional Mongolian app development. Even if you are not literate in Mongolian, your help reviewing the code, making comments and questions, giving answers or even up-voting the question would be appreciated.
Mongolian Vertical TextView
A Mongolian TextView needs to have the following requirements:
- Supports a traditional Mongolian font
- Displays text vertically from top to bottom
- Line wrapping goes from left to right.
- Line breaks occur at a space (same as English)
(Having the TextView support the Mongolian font is not an absolute requirement since the TypeFace can be set later, but it is a convenience when many TextViews are being used.)
My answer is below but I welcome other ways of solving this problem.
Other related questions in this series:
- How to make a traditional Mongolian script EditText in Android
- How to make a traditional Mongolian script ListView in Android
- More to come... (Toast, Dialog, Menu)
iOS: