-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Comma included in load font #8084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-2.0
Are you sure you want to change the base?
Comma included in load font #8084
Conversation
I was testing it, it fails somewhere. I'll check it soon. |
Can we included a test case for this ? |
Hi @davepagurek , when I included only comma with
I think the web editor renames uploaded font files to UUID-like names (e.g. fbb83b…), which may or may-not start with a digit. Such names need quotes to work as a font-family. if (!((name.startsWith("'") && name.endsWith("'")) ||
(name.startsWith('"') && name.endsWith('"')))) {
name = "'" + name.replace(/'/g, "\\'") + "'";
} where we started quoting it everytime but still it was working on firefox correctly but not in chrome, now I am using regex-check and quoting when needed which is working everywhere in chrome, firefox and safari. Do you think the PR looks good @dhowe @davepagurek @ksen0 ? |
I think this regex makes sense! The edge cases we're handling could probably use some documentation though so that we don't forget later, so I think some unit tests would be a good idea, are we able to export this function so we can test it directly in a unit test without loading actual fonts? That way we can show in unit tests that ones starting with a digit need quotes, spaces need quotes, commas need quotes, and fully alphabetic (or alphanumeric as long as the first character is alphabetic) don't need quotes. |
Sure, thanks for the confirmation. I'll see how we can export this function so we can test it directly in the unit test without loading the actual font. |
@perminder-17 If there are blockers with exporting the function, IMO adding to the manual test suite would also be a good alternative, these are checked before release, so it would still be a way to prevent future regression. |
Resolves #8077
Changes:
Screenshots of the change:
PR Checklist
npm run lint
passes