Reputation: 1703
I am building a tree structure engine using an HTML5 canvas. Each tree node has a name that is read along with several other values from a database. Each node is represented by a block, the size of which is fixed. My problem is that the name of the block is often too long to fit onto the block. How can I determine how long (in width) a piece of text is going to be before adding it to the canvas, and how can I cut it off if it is going to be too long?
Any suggestions would be greatly appreciated.
Upvotes: 1
Views: 1133