javascript - Paper.js PointText Get Baseline Coordinates instead of Bottom Left Corner -
examine paper.js sketch. click on "text" see bounding box. note set leading property same font size. default 1.2 times font size, according documentation.
why there margin space @ bottom of pointtext? how can removed bounding box wraps text tightly? alternatively, how 1 determine y value of true baseline of text, rather we're given?
edit
the "margin" @ bottom letters have descenders, q , p. real question here how can y-coordinate of baseline pointtext? need baseline because how library we're using inserts text, , insertion needs identical.
the spacing correct. change "text" "tejas" , you'll see descenders, in character "j" have equal spacing below them top of capitalized characters.
i don't believe there way text bounds of pointtext item.
as such, think arthur.sw's suggestion best answer. same unless text simple, single line, , not editable. end creating textbox or textarea on canvas , positioning appropriately. it's best solution long-term; i'm not sure why paper should duplicate browser handles.
with you'll want position text relative view or canvas being displayed. you'll want use globaltolocal , localtoglobal
here's sketch helps me visualize relationship between item's coordinate space , global coordinate space.
Comments
Post a Comment