Reputation: 717
I am curious is it possible to get bounding rectangle width and height of font characters with javascript?
Upvotes: 4
Views: 1883
Reputation: 690
depending on your exact implementation, you might find this useful: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/measureText
The CanvasRenderingContext2D.measureText() method returns a TextMetrics object that contains information about the measured text (such as its width for example).
Upvotes: 2