Link to home
Start Free TrialLog in
Avatar of itnifl
itniflFlag for Norway

asked on

Draw/write text on HTML5 canvas with multiple fonts using javascript

Is it possible to draw/write text on a HTML5 canvas with multiple fonts using javascript? I have only been able to set one font for all text that is for the canvas.
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Canvas is a replaced element.  It is implemented much like an image.  in order to apply multiple fonts you would have to carry the fonts with other tags, and you cannot put tags inside a canvas.  

If you need different fonts, you do like you do when you need text in an image you use an absolute positioned element to overlay.  

Cd&
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itnifl

ASKER

I use pt instead if px. When using px I got the result you were showing.