[scribus] deleteText() Resets Frame Attributes
Matt Miller
matt.miller at fastmail.com
Wed Mar 10 22:22:39 UTC 2021
I want to use the API to replace the text of a frame with new text, but I can't empty the text out of the frame without reverting many of the frame's attributes. The main attribute that's causing problems at this point is the font size. For example:
dummy = newDocument((5, 3), (0, 0, 0, 0), PORTRAIT, 1, UNIT_INCHES, PAGE_1, 0, 1)
frame_1 = createText (1, 1, 1, 1)
setFontSize (24, frame_1)
deleteText (frame_1)
After executing the first three lines of code above and then loading (or typing) text into the frame all looks fine. In particular, the text is 24 point. Also, I see from the "Text Properties" window that the font size shows as "24 pt." However, after executing the "deleteText (frame_1)" call above I see from the "Text Properties" window that the font size shows as "12 pt," which is the default point size I have set for text frames in the "Document Setup" window. Also, entering text into the frame confirms that it's now 12 pt. (As an aside, it seems that "getFontSize()" always returns "12.0" regardless of the frame's actual font size.)
deleteText() is reverting other properties, too, like Paragraph Style and Character Style.
As a workaround it seems I can first append my new text to the end of the frame, and then select and delete the original text, which is only a few extra steps, but I didn't want to adopt that as a standard without checking first.
Thanks.
--
Matt Miller
mailto:matt.miller at fastmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20210310/2b3f77df/attachment.htm>
More information about the scribus
mailing list