mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Allows a Typeface object to be added to ReactFontManager
Summary: Currently on Android, React Native can only accept font resource IDs which it internally converts into Typeface objects. This change allows ReactFontManager to be passed a Typeface at runtime to enable e.g. downloading fonts on demand. Changelog: [Android][Added] - Ability to pass a Typeface object to ReactFontManager in addition to a font resource ID Reviewed By: makovkastar Differential Revision: D36138123 fbshipit-source-id: b314e8c7fc28174b5caa017076b6eb3d4f6dbaa8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5dae5936fc
commit
e2dd2e2a6e
@@ -110,6 +110,16 @@ public class ReactFontManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent method to {@see addCustomFont(Context, String, int)} which accepts a Typeface
|
||||
* object.
|
||||
*/
|
||||
public void addCustomFont(String fontFamily, @Nullable Typeface font) {
|
||||
if (font != null) {
|
||||
mCustomTypefaceCache.put(fontFamily, font);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add additional font family, or replace the exist one in the font memory cache.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user