You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2019/01/09 03:04:21 UTC
[incubator-weex] branch master updated: [weex][android] fix the
custom file ttf not work well, need replace uri.getPath() with (#1964)
This is an automated email from the ASF dual-hosted git repository.
kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new 425e0a9 [weex][android] fix the custom file ttf not work well, need replace uri.getPath() with (#1964)
425e0a9 is described below
commit 425e0a932a50222fd9b210f5e5bdda80c5c4f913
Author: Bruce too <br...@users.noreply.github.com>
AuthorDate: Wed Jan 9 11:04:17 2019 +0800
[weex][android] fix the custom file ttf not work well, need replace uri.getPath() with (#1964)
like the doc said : with url('file://storage/emulated/0/A/B/**.ttf to custom font by file path, but the result of path format that will like emulated/0/A/B/**.ttf ,rather than storage/emulated/0/A/B/**.ttf which will cause File Not Found Exception. Because getPath format schema storage as authority , as you can see [scheme:][//authority][path][?query][#fragment]
---
android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java b/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java
index 076564e..ae8fc0b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/FontDO.java
@@ -97,7 +97,12 @@ public class FontDO {
mType = TYPE_NETWORK;
} else if (Constants.Scheme.FILE.equals(scheme)) {
mType = TYPE_FILE;
- mUrl = uri.getPath();
+ /**
+ * eg: file://name/A/B.ttf
+ * getPath() = "A/B.ttf",but the real absolute path is "/name/A/B.ttf"
+ * so use getEncodedSchemeSpecificPart() to replaced = "//name/A/B.ttf"
+ */
+ mUrl = uri.getEncodedSchemeSpecificPart();
} else if (Constants.Scheme.LOCAL.equals(scheme)){
mType = TYPE_LOCAL;
} else if (Constants.Scheme.DATA.equals(scheme)) {