Loading api/current.xml +26 −0 Original line number Diff line number Diff line Loading @@ -55625,6 +55625,32 @@ <parameter name="path" type="java.lang.String"> </parameter> </method> <method name="createFromFile" return="android.graphics.Typeface" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="path" type="java.io.File"> </parameter> </method> <method name="createFromFile" return="android.graphics.Typeface" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="path" type="java.lang.String"> </parameter> </method> <method name="defaultFromStyle" return="android.graphics.Typeface" abstract="false" core/jni/android/graphics/Typeface.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -133,6 +133,14 @@ static SkTypeface* Typeface_createFromAsset(JNIEnv* env, jobject, return SkTypeface::CreateFromStream(new AssetStream(asset, true)); } static SkTypeface* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) { NPE_CHECK_RETURN_ZERO(env, jpath); AutoJavaStringToUTF8 str(env, jpath); return SkTypeface::CreateFromFile(str.c_str()); } /////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gTypefaceMethods[] = { Loading @@ -140,9 +148,10 @@ static JNINativeMethod gTypefaceMethods[] = { { "nativeCreateFromTypeface", "(II)I", (void*)Typeface_createFromTypeface }, { "nativeUnref", "(I)V", (void*)Typeface_unref }, { "nativeGetStyle", "(I)I", (void*)Typeface_getStyle }, { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", (void*)Typeface_createFromAsset } { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", (void*)Typeface_createFromAsset }, { "nativeCreateFromFile", "(Ljava/lang/String)I", (void*)Typeface_createFromFile } }; int register_android_graphics_Typeface(JNIEnv* env); Loading @@ -153,4 +162,3 @@ int register_android_graphics_Typeface(JNIEnv* env) gTypefaceMethods, SK_ARRAY_COUNT(gTypefaceMethods)); } graphics/java/android/graphics/Typeface.java +27 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.graphics; import android.content.res.AssetManager; import java.io.File; /** * The Typeface class specifies the typeface and intrinsic style of a font. * This is used in the paint, along with optionally Paint settings like Loading Loading @@ -119,6 +121,26 @@ public class Typeface { return new Typeface(nativeCreateFromAsset(mgr, path)); } /** * Create a new typeface from the specified font file. * * @param path The path to the font data. * @return The new typeface. */ public static Typeface createFromFile(File path) { return new Typeface(nativeCreateFromFile(path.getAbsolutePath())); } /** * Create a new typeface from the specified font file. * * @param path The full path to the font data. * @return The new typeface. */ public static Typeface createFromFile(String path) { return new Typeface(nativeCreateFromFile(path)); } // don't allow clients to call this directly private Typeface(int ni) { native_instance = ni; Loading @@ -140,14 +162,14 @@ public class Typeface { } protected void finalize() throws Throwable { super.finalize(); nativeUnref(native_instance); } private static native int nativeCreate(String familyName, int style); private static native int nativeCreateFromTypeface(int native_instance, int style); private static native int nativeCreateFromTypeface(int native_instance, int style); private static native void nativeUnref(int native_instance); private static native int nativeGetStyle(int native_instance); private static native int nativeCreateFromAsset(AssetManager mgr, String path); private static native int nativeCreateFromAsset(AssetManager mgr, String path); private static native int nativeCreateFromFile(String path); } Loading
api/current.xml +26 −0 Original line number Diff line number Diff line Loading @@ -55625,6 +55625,32 @@ <parameter name="path" type="java.lang.String"> </parameter> </method> <method name="createFromFile" return="android.graphics.Typeface" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="path" type="java.io.File"> </parameter> </method> <method name="createFromFile" return="android.graphics.Typeface" abstract="false" native="false" synchronized="false" static="true" final="false" deprecated="not deprecated" visibility="public" > <parameter name="path" type="java.lang.String"> </parameter> </method> <method name="defaultFromStyle" return="android.graphics.Typeface" abstract="false"
core/jni/android/graphics/Typeface.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -133,6 +133,14 @@ static SkTypeface* Typeface_createFromAsset(JNIEnv* env, jobject, return SkTypeface::CreateFromStream(new AssetStream(asset, true)); } static SkTypeface* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) { NPE_CHECK_RETURN_ZERO(env, jpath); AutoJavaStringToUTF8 str(env, jpath); return SkTypeface::CreateFromFile(str.c_str()); } /////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gTypefaceMethods[] = { Loading @@ -140,9 +148,10 @@ static JNINativeMethod gTypefaceMethods[] = { { "nativeCreateFromTypeface", "(II)I", (void*)Typeface_createFromTypeface }, { "nativeUnref", "(I)V", (void*)Typeface_unref }, { "nativeGetStyle", "(I)I", (void*)Typeface_getStyle }, { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", (void*)Typeface_createFromAsset } { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", (void*)Typeface_createFromAsset }, { "nativeCreateFromFile", "(Ljava/lang/String)I", (void*)Typeface_createFromFile } }; int register_android_graphics_Typeface(JNIEnv* env); Loading @@ -153,4 +162,3 @@ int register_android_graphics_Typeface(JNIEnv* env) gTypefaceMethods, SK_ARRAY_COUNT(gTypefaceMethods)); }
graphics/java/android/graphics/Typeface.java +27 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.graphics; import android.content.res.AssetManager; import java.io.File; /** * The Typeface class specifies the typeface and intrinsic style of a font. * This is used in the paint, along with optionally Paint settings like Loading Loading @@ -119,6 +121,26 @@ public class Typeface { return new Typeface(nativeCreateFromAsset(mgr, path)); } /** * Create a new typeface from the specified font file. * * @param path The path to the font data. * @return The new typeface. */ public static Typeface createFromFile(File path) { return new Typeface(nativeCreateFromFile(path.getAbsolutePath())); } /** * Create a new typeface from the specified font file. * * @param path The full path to the font data. * @return The new typeface. */ public static Typeface createFromFile(String path) { return new Typeface(nativeCreateFromFile(path)); } // don't allow clients to call this directly private Typeface(int ni) { native_instance = ni; Loading @@ -140,14 +162,14 @@ public class Typeface { } protected void finalize() throws Throwable { super.finalize(); nativeUnref(native_instance); } private static native int nativeCreate(String familyName, int style); private static native int nativeCreateFromTypeface(int native_instance, int style); private static native int nativeCreateFromTypeface(int native_instance, int style); private static native void nativeUnref(int native_instance); private static native int nativeGetStyle(int native_instance); private static native int nativeCreateFromAsset(AssetManager mgr, String path); private static native int nativeCreateFromAsset(AssetManager mgr, String path); private static native int nativeCreateFromFile(String path); }