You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/03 07:56:00 UTC

[jira] [Commented] (WEEX-558) 使用自定义字体时android端存在语法兼容性问题

    [ https://issues.apache.org/jira/browse/WEEX-558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16601851#comment-16601851 ] 

ASF GitHub Bot commented on WEEX-558:
-------------------------------------

YorkShen closed pull request #1419: [WEEX-558][Android] Font file url compatible with ' and "
URL: https://github.com/apache/incubator-weex/pull/1419
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 cc5d23f2e9..6176c1a880 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
@@ -73,7 +73,7 @@ private void parseSrc(String src, WXSDKInstance instance) {
       return;
     }
 
-    if (src.matches("^url\\('.*'\\)$")) {
+    if (src.matches("^url\\((('.*')|(\".*\"))\\)$")) {
       String url = src.substring(5, src.length() - 2);
       Uri uri = Uri.parse(url);
       if( instance != null){


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> 使用自定义字体时android端存在语法兼容性问题
> -------------------------
>
>                 Key: WEEX-558
>                 URL: https://issues.apache.org/jira/browse/WEEX-558
>             Project: Weex
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 0.18, 0.19
>            Reporter: billy
>            Assignee: YorkShen
>            Priority: Major
>         Attachments: fontFamily未生效.jpeg
>
>
> 按照[官方文档|http://weex.apache.org/cn/references/modules/dom.html#addrule-type-contentobject-v0-12-0],使用自定义fontFace可通过domModule.addRule来实现,示例如下:
> {code:java}
> domModule.addRule('fontFace', {
>     'fontFamily': "iconfont2",
>     'src': "url('http://at.alicdn.com/t/font_1469606063_76593.ttf')"
> })
> {code}
> 文档中给出的示例中,src对应的字体文件路径字符串的定义是由{color:#FF0000}外部双引号{color}和{color:#FF0000}内部单引号{color}构成
> 但这种写法会被提示字符串要使用单引号,但{color:#FF0000}改成外部单引号内部双引号后,在android端字体未生效{color}
> 复现页面: [http://dotwe.org/vue/eb11eb2ce81d936c8978439df027c66b]
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)