FileDocCategorySizeDatePackage
FontFamily.javaAPI DocAndroid 5.1 API2467Thu Mar 12 22:22:30 GMT 2015android.graphics

FontFamily

public class FontFamily extends Object
A family of typefaces with different styles.
hide

Fields Summary
public long
mNativePtr
Constructors Summary
public FontFamily()

        mNativePtr = nCreateFamily(null, 0);
        if (mNativePtr == 0) {
            throw new IllegalStateException("error creating native FontFamily");
        }
    
public FontFamily(String lang, String variant)

        int varEnum = 0;
        if ("compact".equals(variant)) {
            varEnum = 1;
        } else if ("elegant".equals(variant)) {
            varEnum = 2;
        }
        mNativePtr = nCreateFamily(lang, varEnum);
        if (mNativePtr == 0) {
            throw new IllegalStateException("error creating native FontFamily");
        }
    
Methods Summary
public booleanaddFont(java.lang.String path)

        return nAddFont(mNativePtr, path);
    
public booleanaddFontFromAsset(android.content.res.AssetManager mgr, java.lang.String path)

        return nAddFontFromAsset(mNativePtr, mgr, path);
    
public booleanaddFontWeightStyle(java.lang.String path, int weight, boolean style)

        return nAddFontWeightStyle(mNativePtr, path, weight, style);
    
protected voidfinalize()

        try {
            nUnrefFamily(mNativePtr);
        } finally {
            super.finalize();
        }
    
private static native booleannAddFont(long nativeFamily, java.lang.String path)

private static native booleannAddFontFromAsset(long nativeFamily, android.content.res.AssetManager mgr, java.lang.String path)

private static native booleannAddFontWeightStyle(long nativeFamily, java.lang.String path, int weight, boolean isItalic)

private static native longnCreateFamily(java.lang.String lang, int variant)

private static native voidnUnrefFamily(long nativePtr)