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

Fix text displaying bug for browsers that block canvas data extraction #5342

Merged
merged 3 commits into from Jan 10, 2019

Conversation

ProtonGustave
Copy link
Contributor

@ProtonGustave ProtonGustave commented Jan 9, 2019

Description of change

There is some privacy-focused browsers(Firefox 58+, Tor) that disallow canvas data extraction(toDataURL, getImageData) by default(not really disallow, just return white picture), i.e. they ask for permission to do so(although i don't have a permission request on localhost). TextMetrics.js is using getImageData in static function called measureFont to calculates the ascent, descent and font size of a font-style, but when user decline permission request or just ignore it function return zeroes for ascent, descent and font size, then text element became 1px tall(not visible on screen). No need to use measureFont if we can't, there is fallback in commit that allow to show text if we can't extract canvas data.

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Jan 9, 2019

right, Comodo

@bigtimebuddy bigtimebuddy merged commit c66765f into pixijs:dev Jan 10, 2019
@lock
Copy link

lock bot commented Jan 10, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants