Conversation
JakeQZ
left a comment
There was a problem hiding this comment.
Thanks for working on this.
However, I don't think the solution is correct. From MDN:
The name of a font family. This must be either a single <string> value or a space-separated sequence of <custom-ident> values. String values must be quoted but may contain any Unicode character. Custom identifiers are not quoted, but certain characters must be escaped.
So \"Liberation Serif\" actually represents two space-separated <custom-idents>, the first of which begins with a literal quote, the second of which ends with one. Thus it should be rendered back out with those literal quotes preserved.
In the case of the url function, the parameter is a <string> where quotes are optional. Similarly, special characters which are part of the URL can be escaped (whether or not the URL is enclosed in quotes), so, again, an escaped quote should be parsed as being part of the actual URL.
I think the initial (more common) problem to sort out is when there are escaped quotes inside a quoted string, e.g.
font-family: 'Baker\'s Dozen', serif;
background-image: url("/glyph-image?glyph=\"");Then a separate issue would be to fix any problems with escaping in unquoted strings or <custom-idents>.
Does this make sense?
Often times font definitions include escaped quotes. Currently these are not parsed correctly. This PR resolves this.