How to retrieve a list of available/installed fonts in android?

前端 未结 4 923
野的像风
野的像风 2020-11-27 17:11

In Java I would do something like:

java.awt.GraphicsEnvironment ge = 
                      java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[         


        
4条回答
  •  清歌不尽
    2020-11-27 18:03

    Taken from Mark Murphy's answer on the Android Developers mailing list:

    http://developer.android.com/reference/android/graphics/Typeface.html

    There are only three fonts: normal (Droid Sans), serif (Droid Serif), and monospace (Droid Sans Mono).

    While there may be additional fonts buried in WebKit somewhere, they appear to be inaccessible to developers outside of WebKit. :-(

    The only other fonts are any TrueType ones you bundle with your application.

    Edit: Roboto is a new font which came in with Android 4.0. You can use this library project to use it in all versions back to API level 4 https://github.com/mcalliph/roboto-text-view

提交回复
热议问题