Thanks for the answers.
Unfortunately the following code using the "as-original-type" did not work for me in the Development Toolkit (maybe I missed to change something?):
1AVAL tw:"Text width" as-original-type # so tw should be "DOUBLE"
2SET th:(2*(inh-(CM ( (tw/2)*(CMS inh)/(CMS inw) ))))
3# Print the "debug-recatngle"
4RECTANGLE x:(tabx1-(CM tw/2)) y:(taby1-(th/2)) w:(CM tw) h:(th)
Changing the type did the trick, and this is (part of) the code that I am currently using:
1AVAL tw_str:"Text width"
2SET tw:(CM (tw_str))
3SET th:(2*(inh-(CM ( (CMS tw/2)*(CMS inh)/(CMS inw) ))))
4# Print the text
5FONT color:(fontcolor)
6AVAL nametext:"Name"
7TEXT (nametext) x:(tabx1) y:(taby1) w:c:(tw) h:c:(th) line-break:rigorous
8# Print the "debug-recatngle"
9#RECTANGLE x:(tabx1-(tw/2)) y:(taby1-(th/2)) w:(tw) h:(th)
I decided to use CM instead of VAL so that both tw and th are measured values in hopes of making the whole thing a bit easier to read/understand.