Check the family of a Typeface object in Android

前端 未结 2 1118
你的背包
你的背包 2021-01-19 13:34

Is it possible to check what family a Typeface object is using in Android API 8?

I am creating the Typeface on a Paint object like so

//Simplified co         


        
2条回答
  •  清酒与你
    2021-01-19 14:03

    Not readily. The key to the family is a native_instance int, which is package-private and is not directly exposed, as you can see in the source code.

    There are various nasty ways of getting at that information, which may or may not work on all devices and all past/present/future versions of Android.

    Perhaps you could create your own wrapper object around Typeface that tracks this information.

提交回复
热议问题