mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Subsetting embedded fonts: Fix an error when subsetting embedded fonts on windows if the username contains quotes or apostrophes. Fixes #1316533 [subset all embedded fonts > colect_font_stats error](https://bugs.launchpad.net/calibre/+bug/1316533)
This commit is contained in:
parent
1294718845
commit
418cb87f13
@ -253,6 +253,10 @@ class StatsCollector(object):
|
|||||||
src = rule.get('src', None)
|
src = rule.get('src', None)
|
||||||
if not src:
|
if not src:
|
||||||
continue
|
continue
|
||||||
|
if src.startswith('url(') and src.endswith(')') and src[4] not in {'"', "'"}:
|
||||||
|
# Quote the url otherwise cssutils fails to parse it if it has
|
||||||
|
# ' or " in it
|
||||||
|
src = "url('" + src[4:-1].replace("'", "\\'") + "')"
|
||||||
style = self.parser.parseStyle('background-image:%s'%src, validate=False)
|
style = self.parser.parseStyle('background-image:%s'%src, validate=False)
|
||||||
src = style.getProperty('background-image').propertyValue[0].uri
|
src = style.getProperty('background-image').propertyValue[0].uri
|
||||||
name = self.href_to_name(src, '@font-face rule')
|
name = self.href_to_name(src, '@font-face rule')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user