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

Phaser sizing issue #610

Closed
jonathanKingston opened this issue Apr 17, 2021 · 3 comments · Fixed by #657
Closed

Phaser sizing issue #610

jonathanKingston opened this issue Apr 17, 2021 · 3 comments · Fixed by #657

Comments

@jonathanKingston
Copy link
Collaborator

jonathanKingston commented Apr 17, 2021

Phaser uses canvas to detect text sizing, which with the fingerprint protection enabled returns the wrong results: phaserjs/phaser#5625


...I get reports of text on my phaser app (automeme.yazaa.zone) being misaligned.

Originally posted by @Yazir in #574 (comment)

Also: phaserjs/phaser#5625
Related: #585

@jonathanKingston
Copy link
Collaborator Author

@Yazir there isn't an update at present, I can reproduce the issue mentioned, I'm not sure if there is an immediate mitigation here. I can see that phaser use MeasureText code which produces an image like:
image

The algorithm we currently use discards blank pixels but they're using red. I need to think of a way to ignore all contiguous background colours like this without reintroducing memory / performance problems like #574

@Yazir
Copy link

Yazir commented Apr 17, 2021

I see. I'd like to request a whitelist for my app then if that's a possibility (automeme.yazaa.zone) .

For phaser users stumbling upon this issue: I have asked Phaser author about the issue and one workaround is to generate TextMetrics outside of canvas and use that for texts so positioning comes predefined, but it is a hassle to do for every text. Especially that it's to workaround issue coming from a single browser extension.

   //  If you provide the Text Metrics in the Text Config then you can
    //  avoid it having to create a canvas, draw to it, then scan the canvas,
    //  in order to calculate the metrics internally.
    var config1 = {
        x: 100,
        y: 100,
        text: 'Phaser III',
        style: {
            fontSize: '48px',
            fontFamily: 'Arial',
            color: '#ffffff',
            metrics: {
                ascent: 45,
                descent: 10,
                fontSize: 55
            }
        }
    };

    var text = this.make.text(config1);

    //  You can get the metrics from a Text object by doing this:

    console.log(text.getTextMetrics());

    console.log(text.toJSON());

jonathanKingston added a commit to duckduckgo/content-blocking-lists that referenced this issue Apr 18, 2021
Add automeme.yazaa.zone to canvas list, see: duckduckgo/duckduckgo-privacy-extension#610
jonathanKingston added a commit to duckduckgo/content-blocking-lists that referenced this issue Apr 18, 2021
@jonathanKingston
Copy link
Collaborator Author

I'd like to request a whitelist for my app then if that's a possibility (automeme.yazaa.zone) .

I added the site to the override list: duckduckgo/content-blocking-lists#18 for now.

but it is a hassle to do for every text. Especially that it's to workaround issue coming from a single browser extension.

@Yazir for reference it's also the same for Brave and Tor users too: brave/brave-browser#15326

jonathanKingston added a commit to jonathanKingston/duckduckgo-privacy-extension that referenced this issue May 12, 2021
jonathanKingston added a commit to jonathanKingston/duckduckgo-privacy-extension that referenced this issue May 12, 2021
jonathanKingston added a commit to jonathanKingston/duckduckgo-privacy-extension that referenced this issue May 12, 2021
jonathanKingston added a commit that referenced this issue May 12, 2021
Fixes #610

Co-authored-by: Jonathan Kingston <jkingston@duckduckgo.com>
kdzwinel pushed a commit that referenced this issue Jun 1, 2021
Fixes #610

Co-authored-by: Jonathan Kingston <jkingston@duckduckgo.com>
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 a pull request may close this issue.

2 participants