Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[WEEX-558][Android] Font file url compatible with ' and " #1419

Merged
merged 2 commits into from
Sep 3, 2018

Conversation

luckybilly
Copy link
Contributor

issue: https://issues.apache.org/jira/browse/WEEX-558

use costumer fontFace like this:

const domModule = weex.requireModule('dom')
domModule.addRule('fontFace', {
  'fontFamily': "iconfont2",
  'src': "url('http://at.alicdn.com/t/font_1469606063_76593.ttf')"
})

double quotes is outside for font file url, it will make an error with lint.

when set as this, the font face does not work with android:

  'src': 'url("http://at.alicdn.com/t/font_1469606063_76593.ttf")'

it cause by FontDO

@weex-bot
Copy link

weex-bot commented Aug 12, 2018

Fails
🚫 Failed to run assembleDebug task for android.
Messages
📖 android build verification finished.

Generated by 🚫 dangerJS

@@ -73,7 +73,7 @@ private void parseSrc(String src, WXSDKInstance instance) {
return;
}

if (src.matches("^url\\('.*'\\)$")) {
if (src.matches("^url\\((('[^']*')|(\"[^\"]*\"))\\)$")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use ^url\\((('.*')|(\".*\"))\\)$ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea is that no quotes are allowed inside http url.
Maybe you are right, without this restriction will get better compatibility.
Would you like me to change the code?

@luckybilly
Copy link
Contributor Author

@YorkShen I have changed the regex to allow quotes inside the url of font file

@YorkShen YorkShen merged commit 4c7c1d1 into apache:master Sep 3, 2018
Darin726 pushed a commit to Darin726/incubator-weex that referenced this pull request Sep 12, 2018
* apache/master:
  [WEEX-558][Android] Font file url compatible with ' and " (apache#1419)
Darin726 pushed a commit to Darin726/incubator-weex that referenced this pull request Sep 12, 2018
…o merge_all_code

* 'merge_all_code' of gitlab.alibaba-inc.com:weex/weex:
  [core] fix data render ref problem
  [core] update so
  [core] fix JNI pinned array reference table overflow
  [core] miss file in cmakelist
  [core] fix string add sequence problem
  [Android] fix WXHeader sticky problem
  [WEEX-558][Android] Font file url compatible with ' and " (apache#1419)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants