It is currently Fri Apr 26, 2024 9:52 am


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: 3975
Location: 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.

_________________
TinT


Top
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) manipulate a portion of text inside a text layer using python-fu

2

No new posts Reducing layer size without loosing quality?

2

No new posts script to load text file and create text layer

6

No new posts How to make a python or scrip fue from text

2

No new posts Eager to learn to input text in python script (Solved)

2



* Login  



Powered by phpBB3 © phpBB Group