How to programmatically create and save an image with some text?

In Luxor I have problems to center the text string: How to center a text with Luxor - #2 by cormullion

So I went back to Compose, but not speaking Lisp, it looks very scaring.
I have tried this, but the text doesn’t go on top of the rectangle:


using Colors, Compose
set_default_graphic_size(300px,300px)
img = compose(context(units=UnitBox(0,0,2,2)),
  compose(compose(context(), rectangle()), fill("white")),
  (context(), text(1, 1, "123", hcenter, vcenter), stroke("red"), fontsize(30pt)),
)