[Ipe-discuss] Retrieving a text object's height in LUA

Lluís Alemany Puig lluis.alemany.puig at upc.edu
Thu Apr 1 14:34:26 CEST 2021


Hello all,

I am writing an Ipelet that creates text objects that have to be 
arranged so that they don't overlap with nearby objects (also created by 
the Ipelet). For this I need to retrieve the text's dimensions and 
calculate its position accordingly. I know how to create a text object,

     local text = ipe.Text(model.attributes, "text here", 
ipe.Vector(position_x, position_y))
     model:creation("Add text", text)

how to retrieve its width,

     text:get("width")

and how to render the text with LaTeX so that the width returned 
corresponds to the rendered text

     model.doc:runLatex()

All the information is at http://ipe.otfried.org/manual/luaobj.html. 
Unfortunately, I can't figure out how to retrieve its height, since the 
following lines issue an error

     text:get("height")
     text:height()

Is it possible to retrieve the height of a text object in LUA in the 
current version of Ipe?

Thank you,

Lluís Alemany



More information about the Ipe-discuss mailing list