It is currently Fri Nov 24, 2017 12:25 am


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Python - How to set text on layer without loosing formating
PostPosted: Wed May 17, 2017 1:34 pm  (#1) 
Offline
New Member

Joined: May 17, 2017
Posts: 1
I have realy simple script:
def replace(image, drawable):
    layers = image.layers
    for layer in layers:
        if pdb.gimp_drawable_is_text_layer(layer):
            pdb.gimp_text_layer_set_text(layer,'aaa')


It works. After this script on every text layer is text 'aaa' but my settings of font size and color disappear (after script text is always black and font size = 18).

What is wrong?


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Python - How to set text on layer without loosing formating
PostPosted: Wed May 17, 2017 2:28 pm  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 2884
Location: Tin from Victoria BC Canada
Which gimp are you using.
It works on mine (the formatting, font and font size stays the same).
I am on Gimp 2.8.20

PS: I think I know what you did. I recreated your problem. You created text layers, then instead of setting/changing font options using tool options you selected the text and changed the font and font size for that text. So that doesn't work because the text layer itself still has the font and font size of default Sans 18. So when you set the text the format is lost because that text layer is still Sans 18. To make it work, you have to change font settings in Tool options then create text that way, you're setting the text layer's font and fontsize and not just for the text you've created. I hope i am explaining that right.

_________________
T.
Image gimplearn.net                                                                           


Top
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Python layer effects

17

No new posts How to create new layer from text boundaries on a different layer?

2

No new posts Adding a Layer to an Image in a Python Plugin

6

No new posts Gimp delete layer error from Python (Console)

2

No new posts GIMP is loosing my toolbox

2



* Login  



Powered by phpBB3 © phpBB Group