Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,15 @@ public static Typeface getFontTypeface(Context context, String fontFilename) {
return null;
}

File file = new File(fontFilename);
// If fontFilename is a URL, replace the asset URL with the app's data directory path
String fontFilePath = fontFilename;
String rootUrl = WebViewUtils.buildAssetUrl("");
if (fontFilename.startsWith(rootUrl)) {
fontFilePath = fontFilename.replaceFirst(rootUrl,
context.getDir("data", Context.MODE_PRIVATE).toString() + File.separator);
}

File file = new File(fontFilePath);
if (file.exists()) {
return Typeface.createFromFile(file);
}
Expand Down