Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6973319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:05:34+00:00 2026-05-27T17:05:34+00:00

I am trying to visualize text on a canvas vertically (45° counter-clockwise rotated). I

  • 0

I am trying to visualize text on a canvas vertically (45° counter-clockwise rotated). I know that this is possible with the html5 canvas, so this is what I wrote:

function drawText(canvas, text){
    var ctx = canvas.getContext('2d');

    ctx.translate(70, 140);
    ctx.rotate(Math.PI*1.5);

    ctx.fillStyle     = "blue";
    ctx.textBaseline  = "top";

    ctx.fillStyle = "blue";
    ctx.font = '700 55pt Verdana'
    ctx.fillText(text, 10, 20);
}

and the canvas that this is used on has this styles (+ inherrited styles)

canvas.trigger {
        position: relative;
        left: 0;
        width:65;
        height:98;
    }

a.trigger3{
position: absolute;
text-decoration: none;
left: 0;
width:60px;
height:98px;
font-size: 12px;
letter-spacing:0px;
font-family: verdana, helvetica, arial, sans-serif;
color:#fff;
font-weight: 700;
background:#333333;
border:2px solid #444444;
-moz-border-radius-topright: 15px;
-webkit-border-top-right-radius: 15px;
-moz-border-radius-bottomright: 15px;
-webkit-border-bottom-right-radius: 15px;
-moz-border-radius-bottomleft: 0px;
-webkit-border-bottom-left-radius: 0px;
display: block;
z-index:1;
}

The code has this result:

enter image description here

while the final result should be a button (that one with the rounded courners) and the whole text “Details”.
There are two problems with this code: first of all, when I give a normal size for the ctx.font (e.g. 12pt) the text is too small to read and the second one: when I use a bigger font-size like in this code (55pt) the height of the text is perfect, but it is too long (heigh when you rotated it) so only a part of the text (“Details”) is shown.

Does someone see a problem with this code? I think it would be style-related, because when I do the same with no other styles in the Tryit Editor of w3schools the font is perfect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:05:34+00:00Added an answer on May 27, 2026 at 5:05 pm

    I think your problem is being caused by the fact that you’re setting the width and height of the canvas through a style sheet, instead of the width/height properties of the canvas element. For some reason setting the canvas width/height through its style sheet causes weird scaling issues.

    If you take a look at http://jsfiddle.net/bfzCS/2/, you’ll see what I mean. The same code you provided, I just changed it so that it would set the width/height by way of style sheet. Notice how it’s all stretched out? I think it has something to do with the fact that the stylesheet width/height actually controls the rendering surface, where as the width/height element properties control the size of the element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large possible data set that I am trying to visualize
I am trying to visualize how to create a search for an application that
I am trying to understand / visualize the elements that come with forking a
I am trying to use a Canvas to display objects that have world location
I'm trying to write some jquery that will call a function when an object
I'm trying to visualize data like in this spreadsheet https://docs.google.com/spreadsheet/ccc?key=0AhtsNUEmDE6MdE0ybXppcG1jampsVnBfZWpEZm9vbmc . So I would
I'm trying to make an iPhone/iPad application that uses VTK to visualize DICOM images
I have some data about a day's events that I'm trying to visualise as
Trying to get my css / C# functions to look like this: body {
Trying to find some simple SQL Server PIVOT examples. Most of the examples that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.