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

context.font doesn't update on alpine #134

Open
2fd opened this issue Jan 23, 2023 · 3 comments
Open

context.font doesn't update on alpine #134

2fd opened this issue Jan 23, 2023 · 3 comments

Comments

@2fd
Copy link

2fd commented Jan 23, 2023

I'm trying to create an image inside a node container on alpine, but the prop front doesn't update if I assign a new value.

As a Proof of Concept I setup this repo https://github.com/2fd/poc-skia-canvas-context to show the error.

It runs the following test:

    // Create canvas  and context
    const canvas = new Canvas(100, 100)
    const context = canvas.getContext('2d')

    // Check default value
    expect(context.font).toBe('10px sans-serif')

    // Check update
    context.font = 'normal 600 20px/24px Times'
    expect(context.font).toBe('normal 600 20px/24px Times')

and run it on node 14, 16, 18, and 20 using slim and alpine and it fails on every version of alpine

Screenshot 2024-04-07 at 11 20 41 PM

the value of font never was updated

Screenshot 2023-01-23 at 01 15 49

@arthurbdev
Copy link

Did you find a workaround?

@2fd
Copy link
Author

2fd commented Apr 8, 2024

no, I didn't

@2fd
Copy link
Author

2fd commented Apr 8, 2024

Hi @arthurbdev, after digging a little bit a found the root cause here. If you try to update the context with a font that is not present on your distro it will ignore any other change. In which case the solution will be to install the font you will use.

I have tested it and it worked just fine:
Screenshot 2024-04-07 at 11 50 11 PM

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