-
public class ReactFontManager
Responsible for loading and caching Typeface objects.
This will first try to load a typeface from the assets/fonts folder. If one is not found in that folder, this will fallback to the best matching system typeface.
Custom fonts support the extensions `.ttf` and `.otf` and the variants `bold`, `italic`, and `bold_italic`. For example, given a font named "ExampleFontFamily", the following are supported:
- ExampleFontFamily.ttf (or .otf)
- ExampleFontFamily_bold.ttf (or .otf)
- ExampleFontFamily_italic.ttf (or .otf)
- ExampleFontFamily_bold_italic.ttf (or .otf)
-
-
Method Summary
Modifier and Type Method Description static ReactFontManager
getInstance()
Typeface
getTypeface(String fontFamilyName, int style, AssetManager assetManager)
Typeface
getTypeface(String fontFamilyName, int weight, boolean italic, AssetManager assetManager)
Typeface
getTypeface(String fontFamilyName, int style, int weight, AssetManager assetManager)
Typeface
getTypeface(String fontFamilyName, TypefaceStyle typefaceStyle, AssetManager assetManager)
void
addCustomFont(Context context, String fontFamily, int fontId)
void
setTypeface(String fontFamilyName, int style, Typeface typeface)
Add additional font family, or replace the exist one in the font memory cache. -
-
Method Detail
-
getInstance
static ReactFontManager getInstance()
-
getTypeface
Typeface getTypeface(String fontFamilyName, int style, AssetManager assetManager)
-
getTypeface
Typeface getTypeface(String fontFamilyName, int weight, boolean italic, AssetManager assetManager)
-
getTypeface
Typeface getTypeface(String fontFamilyName, int style, int weight, AssetManager assetManager)
-
getTypeface
Typeface getTypeface(String fontFamilyName, TypefaceStyle typefaceStyle, AssetManager assetManager)
-
addCustomFont
void addCustomFont(Context context, String fontFamily, int fontId)
-
setTypeface
void setTypeface(String fontFamilyName, int style, Typeface typeface)
Add additional font family, or replace the exist one in the font memory cache.
-
-
-
-