mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 08:55:34 +00:00
Catch exception when creating Typeface
This commit is contained in:
parent
6b98a51c21
commit
72ca81fcdb
1 changed files with 4 additions and 5 deletions
|
|
@ -613,17 +613,16 @@ public final class KMManager {
|
|||
public static Typeface getFontTypeface(Context context, String fontFilename) {
|
||||
Typeface font = null;
|
||||
|
||||
if (fontFilename != null) {
|
||||
if (FileUtils.hasFontExtension(fontFilename)) {
|
||||
try {
|
||||
if ((fontFilename != null) && FileUtils.hasFontExtension(fontFilename)) {
|
||||
File file = new File(fontFilename);
|
||||
if (file.exists()) {
|
||||
font = Typeface.createFromFile(file);
|
||||
} else {
|
||||
font = null;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to create Typeface: " + fontFilename);
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue