How It Works
Text objects in the Cadence PCB Editor (Allegro) may look simple enough but in reality they are highly detailed and convoluted. Programatically speaking, a text object is READ ONLY by default. This means you are unable to programatically change the object in Cadence SKILL. Even if you were able to change the "rotation" property, it would not work as you would expect (more on this below) and your text would not only be rotated but it would also be moved to a new location.
The way around the read only problem is simple. You just delete the text object and create a new one but this is where things start to get very convoluted. For example, we have a regular text object on the board with 0 degrees of rotation:
This text object has an (X,Y) location on the board (the GREEN cross indicates this point) and the object also has a "Bounding Box" which surrounds the entire object (the YELLOW box with a center at the X):
As you can see above, the (X,Y) location of the text object is actually inside the Bounding Box and the (X,Y) location is NOT centered inside the Bounding Box. Even worse, the text itself is not centered withing the Bounding Box.
It may come as a surprise but the most important thing here is actually the Bounding Box because it alone defines whether or not this object overlaps some other object. As I'm sure you've figured out (the hard way, and countless times) overlaping objects is can be very bad.
Since you want to try keeping the bounding box in the same place, the fact that your text is NOT centered in the bounding box means it will shift slightly. There is no easy way to get around this behavior and even if there was it would be unwise since you'd be moving the bounding box to make said adjustment. For example, if you rotate the text from 0 to 180 degrees the text will shift down horizontally by a small amount like this:
PLEASE NOTE the new WHITE cross above, this is the new (X,Y) location of the text object that MUST be calculated in order to keep the Bounding Box centered. If you had just rotated the text object without calculating a new (X,Y) location, you would end up with a real mess like this:
As you've probably already guessed, thing get even more interesting when who change the text rotation in such a way that it changes the size or shape of the bounding box. The best you can do in such a situation is keep the center of the bounding box in the same place. For example, if you change from 0 degrees to 45 degrees, the size and shape of the bounding box will change: