Skip to main content
Bumped by Community user
Bumped by Community user
fixed spelling & grammar
Source Link
Pikalek
  • 12.5k
  • 5
  • 45
  • 52

iI am making a HTML5 game using javascript with canvas. iI am implementing a custom font adding @font-face style@font-face style tag to header in the .html file, then if iI set canvas.context2D.font = "10px FONT_NAME" it works and until here i dont have an issuethat part seems to work fine.

butBut when iI scale context2Dcontext2D using canvas.context2D.scale i lostI lose the font and when iI try to set it again using canvas.context2D.font = "10px FONT_NAME" it does not work.

itIt is important to me to set different fonts cause abecause the game can use those in different UI or levels, any idea. How can I fix this problem?

i am making a HTML5 game using javascript with canvas. i am implementing a custom font adding @font-face style tag to header in .html file, then if i set canvas.context2D.font = "10px FONT_NAME" it works and until here i dont have an issue.

but when i scale context2D using canvas.context2D.scale i lost the font and when i try to set it again using canvas.context2D.font = "10px FONT_NAME" it does not work.

it is important to me to set different fonts cause a game can use those in different UI or levels, any idea?

I am making a HTML5 game using javascript with canvas. I am implementing a custom font adding @font-face style tag to header in the .html file, then if I set canvas.context2D.font = "10px FONT_NAME" it works and that part seems to work fine.

But when I scale context2D using canvas.context2D.scale I lose the font and when I try to set it again using canvas.context2D.font = "10px FONT_NAME" it does not work.

It is important to me to set different fonts because the game can use those in different UI or levels. How can I fix this problem?

Source Link

using javascript canvas.context.scale resets custom font

i am making a HTML5 game using javascript with canvas. i am implementing a custom font adding @font-face style tag to header in .html file, then if i set canvas.context2D.font = "10px FONT_NAME" it works and until here i dont have an issue.

but when i scale context2D using canvas.context2D.scale i lost the font and when i try to set it again using canvas.context2D.font = "10px FONT_NAME" it does not work.

it is important to me to set different fonts cause a game can use those in different UI or levels, any idea?