Dmytro
Dmytro

Reputation: 717

How to get width and height of bounding rectangle of font character?

I am curious is it possible to get bounding rectangle width and height of font characters with javascript?

enter code here

Upvotes: 4

Views: 1883

Answers (1)

Conan
Conan

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

Related Questions