poemsk / mmtext

A library to embed Myanmar Unicode on Android apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MMText

Developed by Technomation

A library to embed Myanmar Unicode on Android apps because normal embedding just don't work on some(most) devices.

Embedding Myanmar Unicode Standardized fonts using setTypeface don't work on devices that doesn't support reordering. Also some devices have a setting called display font and if a user choose zawgyi, he won't see unicode font even the font is embedded by setTypeface(). So, Technomation made a libarary called MMText. You can download the project and see the sample app for usage. All contributions are welcomed.

#How to use How does MMText work?

MMText uses a font called “mymm.ttf”. This font is an XPartial font with two code points for each glyph. So, we can shift the code points of the String for Samsung devices. So basically, this font is neither Unicode nor Zawgyi.

Embedding

There are several methods to embed Myanmar Font in your views.

prepareView(Context c, View v, Int EncodedText, boolean SamsungSafe, boolean Syllablebreak)

The first parameter is the context of the encoded text. I think you are already familiar with this. The second one is EncodedText type. The values are mmtext.TEXT_UNICODE, mmtext.TEXT_ZAWGYI, mmtext.TEXT_XPartial. This is the original encoded type of the String of your view. The third parameter is a boolean value for Samsung devices, the characters code points will be shifted so it can display correctly on Samsung. It may effect the performance, so you can check whether the device is Samsung or not and set “false” for non Samsung devices. The last parameter is for SyllabelBreak. The sentence will be broken into words. It may also effect the performance on listviews and recyclerviews where views need to be created constantly.


prepareViewGroup(Context c, View v, Int EncodedText, boolean SamsungSafe, boolean Syllablebreak)

Almost same as prepareView() but this is for view groups and it will embed all text of the views inside the particular view group. So you need to use same encoding(Unicode or Zawgyi) for all views. This works by looping all views.


prepareActivity(Context c, ViewGroup root, int EncodedText, boolean SamsungSafe, boolean SyllabelBreak)

For embedding all views of an Activity including ActionBar(Toolbar). This works by looping all viewgroups.


Custom Views

mmtext also provides custom views for TextView and Button views. Just use <mm.technomation.mmtext.MMTextView /> instead of <TextView /> for TextView and <mm.technomation.mmtext.MMButtonView /> instead of for Buttons. You can use all methods and attributes as normal TextView, Button. But you must use setMyanmarText(String text) and getMyanmarText() instead of setText(String text) and getText() if you use custom views. If you use prepare… methods, you must use mmtext.getMMText() method to get the text of those views.

#License

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004

Copyright (C) 2004 Sam Hocevar sam@hocevar.net

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. You just DO WHAT THE FUCK YOU WANT TO.

You can get a copy of the license here

About

A library to embed Myanmar Unicode on Android apps.


Languages

Language:Java 100.0%