Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    310
    Thanks
    23
    Thanked 0 Times in 0 Posts

    HTML5 Text Canvas in variable

    I am writing text on Canvas. I want to know if the font can be placed in variable?

    For example you want the text to be italic, 30pt in size and Arial as font family, so the code is like this:

    context.font = 'italic 30pt Arial';

    What I want is to place the font-style, size and family in variables, so I tried this:

    Code:
    var style = 'italic';
    var size = '30pt';
    var family = 'Arial'
    
    context.font = 'style size family';
    It does not work I think...

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    310
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Already tackled. Forgot to remove quotes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •