Using two additional fonts in Android

I have two additional fonts that are installed on my computer (Linux) that are used to render each character that the two fonts have.

I would like to use the same fonts in Android. Unfortunately, I don't know how to do this (I know how to load one font).

I tried to combine them with FontForge, but unfortunately I couldn't because the total number of glyphs exceeds 65535 glyphs (which is the limit of the sfnt format).

  • Is it possible to jump over 65535 glyphs so that the font can be used in Android?

  • If not, is there a way to use these fonts together in Android as a whole, so that characters not recognized by the font are recognized by another (like my computer)?

  • If not, is it possible to use two fonts in the TextView so that characters not recognized by the font are recognized by the other?
    I know we can use Spannable to use different fonts for different parts of the TextView, but that's not really my need here.

  • If not, is it possible to detect all the unrecognized characters of my TextView so that I can use a different font just for them?

  • Is it possible to use the "font-family" CSS font style in the TextView to provide an alternate font in case the former fails for some characters?

+3


source to share


1 answer


Thanks to the direction given by JaiSoni, I was able to find a way to solve my problem with HTML and CSS: I used a WebView and declared @ font-face to define my fonts. Then I used them in the "font-family" CSS attribute like this:

<style type="text/css">
   @font-face {font-family: MyFont; src: url("file:///android_asset/fonts/font.ttf")}
   @font-face {font-family: MyFont2; src: url("file:///android_asset/fonts/font2.ttf")}
   body {font-family: MyFont2, MyFont; }
</style>

      



Many thanks.

0


source







All Articles