Batch Changing font style - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Batch Changing font style (/Thread-Batch-Changing-font-style) |
Batch Changing font style - carmen - 10-14-2019 Hello! I have managed to put together a Gimp plugin (attached) to change font styles a. the font itself b. increase/decrease: font size, letter spacing and line height (separately) c. the font color to foreground color to apply inside: active group, active group & subgroups, or whole image. I find it especially useful for treatment of files with a lot of text layers (maps, diagrams) after scaling the whole image. With a hitch: the plugin works only on text layers, and that property disappears on scaling, to be restored only by clicking on the layer with the text tool and accepting 'edit'--somewhat uphill when you have 20+ text layers. Now, my question is: can there be some way to restore the text to editable from a plugin? (It will be on the wrong font size and requiring further adjustments, but one can always work on a copy.) After much digging, I have found that those former text layers return on Code: pdb.gimp_item_get_parasite_list() a 'tuple' containig "gimp-text-layer" (so, one can pick them out from the other layers), but I haven't found any way to restore them. Something like 'open as text layer' (with options) must exist in the Gimp internals... So, please: any ideas? Thanks! RE: Batch Changing font style - Ofnuts - 10-14-2019 Maybe it exists in the Gimp internals and maybe not . If it is not exposed you are a bit out of luck. Personally I think that Gimp just recreates a layer from the parasite info. The only advantage it has on you is that it can use a string with mixed formatting. As a side note creating a text with size 10 and scaling it up 2x doesn't create the same shape as creating the text in size 20. In the picture below, the blue is a Roboto Heavy size 62 scaled up to match the red which is native size 124: [attachment=3266]
RE: Batch Changing font style - carmen - 10-14-2019 (10-14-2019, 06:47 AM)Ofnuts Wrote: Maybe it exists in the Gimp internals and maybe not . If it is not exposed you are a bit out of luck. Personally I think that Gimp just recreates a layer from the parasite info. The only advantage it has on you is that it can use a string with mixed formatting. OK--I shall try everything at the gimpparasite page of GIMP Base Library Reference Manual--hopefully, some will rescue the data from the parasite and allow me to inset them back as a new text layer ... I was hoping for a pointer on which ones to try, being green as green... Quote:As a side note creating a text with size 10 and scaling it up 2x doesn't create the same shape as creating the text in size 20. In the picture below, the blue is a Roboto Heavy size 62 scaled up to match the red which is native size 124:Well--that ought to be expected, ought it not? --Your own observations on 'bendiness' in the ofn-bend-path pluguin give some pointers in path deformation on transforms --Latex goes to the trouble of creating lots of 'virtual fonts' for each of its fonts to address size change --Some font packages come with different versions for size (Serif6Beta-Regular.otf, Serif12Beta-Regular.otf, Serif72Beta-Regular.otf)... That just shows that if you have a file with lots of text, scale it and wish to continue editing by adding some more text, you ought to edit the scaled text layers also, to get a uniform look... RE: Batch Changing font style - Ofnuts - 10-14-2019 In my own text-info script: Code: def text_info(img,layer): RE: Batch Changing font style - carmen - 10-14-2019 (10-14-2019, 12:32 PM)Ofnuts Wrote: In my own text-info script:Thanks a ton! As always ... the cat's pajamas! |