0
votes

I want to display a language (other than English) with my own text encoding/decoding methods. I have my database in binary, where each letter is represented as 16-bit. I also have the information available for the charset mapping.

Problem is there are some extra letters than the standard unicode can show. So I want to write my own character encoding/decoding methods. I also want to design my own font for the character mapping.

How should I approach this in Android app?

1

1 Answers

0
votes

How to add a custom charset

How to add a custom charset is contained in the book Java NIO by Ron Hitchens. You can download sample of Charset and CharsetProvider from the support site. Note that you have to make a file META-INF/services/java.nio.charset.spi.CharsetProvider that contains the FQCN of the additional CharsetProvider and put it into the jar you will make.

You might use a code in https://stackoverflow.com/a/38768564/3902663 on the CustomCharsetProvider.

How to make a custom font file

You can make a .ttf file coordinated to the custom charset with some font editor, like FontForge or Birdfont.

How to add a custom font file into the app

I am unfamiliar with native Android applications, but it seems like you can use Calligraphy to use the additional font in Android applications.