I am trying to convert the X/Y coordinates from the ^FO command to the equivalent ^FT coordinates in such a way that the position of text in the label does not change for rotated text.
The solution that I am looking for was already addressed partially in a question that I previously asked [link added here] (Is it possible to find equivalent X/Y coordinates in order to print some text at the same position using both ^FO as well as ^FT command using ZPL 2)
I am able to find some equations for different rotations (as stated below for font 0) but I am unsure about the exact formula to be used for converting corresponding Y coordinate for 270 rotation or equivalently X coordinate for 180 rotation:
For 0 rotation: FOx = FTx and FOy = FTy - (0.75 * height)
For 90 rotation: FOx = FTx - (0.25 * height) and FOy = FTy
For 180 rotation: FOx = Not found yet and FOy = FTy - (height * 0.25)
For 270 rotation: FOx = FTx - (height * 0.75) and FOy = Not yet found
I guess those missing equations depend on the number of characters in the text to be printed as well as the width of the text but I am not able to find the exact equation.
Any thoughts or suggestions on the finding the same would be greatly appreciated.
The calculation for FOx (180 rotation) would be: FOx = FTx - text length
and for FOy (270 rotation) would be: FOy = FTy - text length
Text length for non-monospaced font (font 0) is difficult to calculate since width will vary for different characters. For monospaced font, the length of text in dots would be calculated for different fonts as per Table 26 (Page #: 1413) in the ZPL Programming guide.
Another useful answer on how to calculate length is answered below: How to Calculate Zebra Font 0 text width?