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

TTFFont.parse should call *Table constructors with explicit @tag param #306

Merged
merged 3 commits into from
Sep 15, 2014

Conversation

yelouafi
Copy link
Contributor

the bug appears when the library is bundled with browserify+uglify (or any other minify lib); by default uglify task mangle function names so in the Table constructor code like @constructor.name would return some 'b'or 'c'which leads to errors hard to debug (since the problem appears only with the minified versions; like this one bpampuch/pdfmake#18 or this one bpampuch/pdfmake#60 )

Is it good or bad to rely on function names at runtime (especially if we are targeting the browser)?
See this interesting discussion pugjs/pug#298 (uglify vs jade)

@devongovett
Copy link
Member

Interesting bug. If I'm not mistaken, the tag parameter should be e.g. 'head' not 'HeadTable'. This line that does the replacement only applies when it uses the constructor names.

IMO we should remove that line entirely since it doesn't work when minified, and just include the tag on the prototype of each table subclass instead of passing it in.

@yelouafi
Copy link
Contributor Author

Excuse me, didn't pay enough attention (in 2 times!)

Those are my first CoffeeScript lines so maybe i've omitted something

@devongovett devongovett merged commit 9f4c634 into foliojs:master Sep 15, 2014
@devongovett
Copy link
Member

Merged, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants