I have created a PyQGIS script that builds a Print Layout with various text labels that are rotated to read vertically on the page. The script creates the labels and places them just fine. But upon performing a view Refresh or even exporting the Layout to PDF, all the vertical labels reset to horizontal.
This is my first foray into building Print Layouts with scripting, so I'm sure I'm missing something basic. But I'm really in a bind if I can't get this to work properly!
I'm running QGIS 3.18.2-Zürich on Windows 10.
The code I'm using to place the labels is:
# Place vertical label newLabel = QgsLayoutItemLabel(layout) newLabel.setText("Vertical Text Label") newLabel.setFont(QFont('Tahoma', 14)) newLabel.setHAlign(Qt.AlignLeft) newLabel.setVAlign(Qt.AlignTop) newLabel.setRotation(270.0) newLabel.attemptMove(QgsLayoutPoint(4.25, 5.50, 3)) newLabel.adjustSizeToText() layout.addLayoutItem(newLabel)