javascript - Fabric.js: Get text bounding box width and height -


i'm using fabric.js. dimensions of rectangle (is "bounding box" correct term?) contains text (represented red box below). default fabric.js box has padding if change padding 0.

enter image description here

i tried context fabric canvas , call .measuretext() didn't give full information needed bounding box.

edit:

it seems there several components of itext object: container, selection area, , text itself. in image below, itext box light blue line. selection area light blue fill. the red box need....it's area exactly contains text (not 1 pixel between such rectangle , extreme parts of text). methods getboundingrectheight , getboundingrectwidth (both deprecated , replaced getboundingrect believe) return height/width of outer itext container box (light blue line).

enter image description here

note: 8 px padded box (the area between blue line , blue fill). if make padding 0, functions still don't give me need.

have tried getboundingrectheight() , getboundingrectwidth() methods available on every fabric object ?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -