I\'m trying to use a custom font on a TextView
. The TextView
text is set with textView1.setText(Html.fromHtml(htmlText));
The
I imagine you want to do a quick refactor on your code in order to incorporate the assets.
I would extend TextView and attempt to parse the HTML and apply the proper typeface at onDraw.
Override setText
and parse the parameter creating a Map for character and the proper typeface that should be used.
Then, override onDraw
and before drawing, change the typeface of super.getPaint()
in accord to the Map you created on the previous step.
The code should look something as the one presented in onDraw
method from How to correctly draw text in an extended class for TextView?, however you will set the previously determined typeface instead of applying super.getTypeface()
.
Hope it helps you