Last active
May 28, 2017 16:55
-
-
Save peterli888/bb333df83d27191a6d7740e18fb4a923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
titanium_mobile-master\android\titanium\src\java\org\appcelerator\titanium\util\TiUIHelper.java | |
import java.io.File;//liyong | |
line-432 before | |
} catch (IOException e) {"Unable to load 'fonts' assets. Perhaps doesn't exist? " | |
//liyong | |
File f = null; | |
f = context.getDir("appdata",0); | |
//Log.w(TAG,"app path="+f.getAbsolutePath());// /data/user/0/com.liyong.testattrlabel/app_appdata | |
String fontPath=f.getAbsolutePath()+"/"+fontFamily+".ttf"; | |
File f_font=new File(fontPath); | |
if(!f_font.exists()){ | |
//Log.e(TAG, "file !exists "+fontPath); | |
}else{ | |
//Log.e(TAG, "file.exists "+fontPath); | |
Typeface loadedTf; | |
try{ | |
loadedTf = Typeface.createFromFile(f_font); | |
}catch(Exception e){ | |
e.printStackTrace(); | |
loadedTf=null; | |
} | |
if(loadedTf!=null){ | |
//Log.e(TAG, "fontFamily load ok="+fontFamily); | |
//tf = loadedTf; | |
synchronized(mCustomTypeFaces) { | |
mCustomTypeFaces.put(fontFamily, loadedTf); | |
} | |
return loadedTf; | |
}else{ | |
//Log.e(TAG, "fontFamily load fail="+fontFamily); | |
} | |
} | |
//liyong |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment