Center text from an x/y locations


I’m trying to achieve this but I haven’t found a solution yet. What I’d like to do would be to set text and an x/y location, and print it centered from this location. The string would be of variable length, but overall the center of the string would always be located at the same location.
I know that I can center a label inside a parent, though how would I go about locating the center of the parent at an x/y location?
The workaround for now that I am using is to set the text, then change the position based on the width and height of the label. It’s not optimum and I am wondering if there is a built in way of doing this in LVGL.

I think you can do this by setting the text then using lv_obj_align_mid.