开发者

Does Typeface.createFromAsset() cache?

开发者 https://www.devze.com 2023-01-28 10:57 出处:网络
Simple question: Does Typeface.createFromAsset() cache? Or should I just keep a reference around in memory to keep handy? The reason why I ask is because I use it quite a 开发者_如何学JAVAlot (all to

Simple question: Does Typeface.createFromAsset() cache? Or should I just keep a reference around in memory to keep handy? The reason why I ask is because I use it quite a 开发者_如何学JAVAlot (all to maintain a single font across many activities / views), so I'm wondering if Typeface will do a simple bit of caching so I don't have to maintain the reference myself.


It doesn't, as best I can tell -- it directly calls down into

http://google.com/codesearch/p?hl=en#uX1GffpyOZk/core/jni/android/graphics/Typeface.cpp&l=115

which looks like it will always open an Asset and create a new typeface for the stream. You can probably double check this yourself; just check and see if you get the same Typeface object from multiple calls to createFromAsset with the same asset.

0

精彩评论

暂无评论...
验证码 换一张
取 消