RESOLVED DUPLICATE of bug 284115 288486
CanvasRenderingContext2D.font doesn't reflect font-weight
https://bugs.webkit.org/show_bug.cgi?id=288486
Summary CanvasRenderingContext2D.font doesn't reflect font-weight
caugner
Reported 2025-02-25 07:18:06 PST
When specifying the font-weight via the CanvasRenderingContext2D.font property, the value is not reflected back. ```js const canvas = document.getElementById('text'); const ctx = canvas.getContext('2d'); ctx.font = 'italic bold 13px "Arial"'; console.log(ctx.font); ctx.font = 'italic 700 13px "Arial"'; console.log(ctx.font); ``` Expected output (as observed in Firefox): ``` italic bold 13px "Arial" italic 700 13px "Arial" ``` Actual output in Safari / Safari iOS: ``` italic 13px Arial italic 13px Arial ``` PS: The font-weight is applied in rendering: https://developer.mozilla.org/en-US/play?id=ltIvYyxzVtuNLZ8ANYXJItjyVVKtJPuXO7OzPmp%2F07rzMIm3HJnrDB2aaJIqtTHhxg56TGFoE%2B74vfNC
Attachments
test case (279 bytes, text/html)
2025-02-25 09:19 PST, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2025-02-25 09:19:06 PST
This was fixed by 287514@main. See bug 284115. In WebKit and after executing the second font setting: `ctx.font = 'italic 700 13px "Arial"';` the output shows `bold` not `700` in the font description. But this is what Chrome does as well. Maybe this is bug but this is a separate issue. *** This bug has been marked as a duplicate of bug 284115 ***
Said Abou-Hallawa
Comment 2 2025-02-25 09:19:19 PST
Created attachment 474347 [details] test case
Note You need to log in before you can comment on or make changes to this bug.