Skip to content
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

Font parsing fails on "normal 12px 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" #74

Open
makareth opened this issue Nov 12, 2019 · 1 comment

Comments

@makareth
Copy link

makareth commented Nov 12, 2019

Seen on v1.0.15.

Sorry to tell but I gave up understanding this regex :
regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:%|in|[cem]m|ex|p[ctx]))(?:\s*/\s*(normal|[.\d]+(?:%|in|[cem]m|ex|p[ctx])))?\s*([-,"\sa-z]+?)\s*$/i;

Shouldn't "normal 12px 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" be parseable ?

Chrome console shows as follows :
ERROR TypeError: Cannot read property '1' of null
at ctx.push../node_modules/canvas2svg/canvas2svg.js.ctx.__parseFont (VM9279 vendor.js:90992)
at ctx.push../node_modules/canvas2svg/canvas2svg.js.ctx.__applyText (VM9279 vendor.js:91039)
at ctx.push../node_modules/canvas2svg/canvas2svg.js.ctx.fillText (VM9279 vendor.js:91066)
at fillText (VM9279 vendor.js:106831)

@murkle
Copy link

murkle commented Jan 23, 2020

See #68 for fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants