Missing documentation and autocomplete for certian functions

some functions do not have an actual API documentation section for themselves, and do not appear in the editor’s autocorrect.
for example, gui.get_text_metrics_from_node() is absent from both (but it does get a mention in a code example in another API documentation area, just not one for itself.)

github issue here

2 Likes

Thank you for pointing this out. I really hope they fix the documentation. It needs simple sample code for everything and everything needs documented.

It is because that function is deprecated in favor of a new function ”resource.get_text_metrics().

We remove the deprecated functions from documentation so that users will use the new function instead.

2 Likes

It is because that function is deprecated in favor of a new function ”resource.get_text_metrics().

oh, i never knew that existed
also what are the 2 return properties of max_ascent and max_descent? their names aren’t really intuitive to me and i’ve never seen elaboration on them.

We remove the deprecated functions from documentation so that users will use the new function instead.

ah, i see now from testing.
the new function is incredibly inconvenient to use in the scope of gui.

i get that you want to shift the UI functions into GOs, but this makes the actual (current) gui a pain to work with.
for example, this code right here, easy and clean to do
gui.get_text_metrics_from_node(node)
is now replaced by this
resource.get_text_metrics(gui.get_font_resource(gui.get_font(node)), gui.get_text(node) , {width=gui.get_size(node).x,leading=gui.get_leading(node),tracking=gui.get_tracking(node),line_break=gui.get_line_break(node)} )
i know that you don’t have to use get_… functions and can instead put in the values directly, but that leads to another problem of making UI changes more tedious to do.

this puts developers in a lose-lose-lose situation where they either keep the old deprecated function that might lose support or fall off in functionality, use the new function and have a massive wall of text that goes off screen (making reading code harder), or use the new function and spend twice (or more) as long when you want to move a box 5 pixels to the right

It’s less about gui but more about using the same function, and also not tying it to ether gui or go.
We try to avoid too much duplicated code for both code size and potential bugs.

Also, you can easily wrap what you wrote into your own gui_get_text_metrics and your’re back to where you were.
Wrapping functions like that is a paradigm we often recommend. We supply building blocks, and users can build upon it.

2 Likes

1 Like

Can you link to the new API from the deprecated API? Or are you already doing that?