Font issues on Alpine #259
-
I'm trying to create an image inside a node container on alpine, but the prop 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 ![]() the value of font never was updated |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Did you find a workaround? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
By default, many Alpine-based docker images don't have any fonts installed, so it's important to either add something to the system or dynamically via FontLibrary.use() if you want to be able to render text. |
Beta Was this translation helpful? Give feedback.
By default, many Alpine-based docker images don't have any fonts installed, so it's important to either add something to the system or dynamically via FontLibrary.use() if you want to be able to render text.