2

I am using various custom fonts in a TextView.

Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/font_name.ttf");
TextView tv = (TextView) this.findViewById(R.id.MyText);
tv.setTypface(tf);
tv.setText("data to view in custom font");

This works for some fonts but not for all I want to use. The failed fonts do so silently. there are no exceptions or other failure indications. The text is displayed in the default font not in the custom font. It is clear that the fonts are not displayed, because the custom fonts I am trying to use are chess piece figurines.

All the fonts work in Word and LibreOffice Writer

How do I determine what is wrong with the font, so I might fix it.

Edits:fixed example code to add tv.setTypeface(tf); clarified what not working means.

4

0 回答 0