Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help! Plugin killed by last update
#1
Hello!
Just registered in search of ... HELP!
I was happy with the grup_chfont.py plugin from the Gimp plugin repository: change font and/or size along a whole Group Layer. 
I dare say that anybody ever using the Gimp for maps/labeled graphics can understand the logic of
* put all your text layers (may easily grow to 20 or more) into a Group Layer to hide/show with one click
* copy said Group Layer and run a plugin to batch-change the font (and perhaps its size) 
* try the different settings on export.
The plugin worked fine until the last update to 2.8.2--then, error message--python cannot pickle ??
As python is over my head, I hope somebody can take a hand at fixing the code--while the Gimp plugin repository worked, I got the notion that such compatibility issues required often only slight changes in the code ... and lots of know-how to make them!
If anybody is interested, I am attaching the actual plugin--released under GNU General Public License v2--its author doesn't seem to be available in any recent forum.
Thanks a lot!


Attached Files
.zip   group_chfont.zip (Size: 953 bytes / Downloads: 414)
Reply
#2
Could be a regression, but yes, it seems you cannot have a GroupLayer as a parameter to a plugin.


Coded two workarounds:

  1. one that keeps the original behavior (you select a group)
  2. one in which you select one the text layers (or any other layer in the same group) and the plugin will update all sibling text layers (and any in subgroups if recursive) (this behavior allow you to change text layers at the "root" level)

.zip   group_chfont.zip (Size: 2 KB / Downloads: 666)

Zip above contains both, they cannot be used together for the time being, you have to pick one or the other. Little testing, so handle with care, and report any problems.
 
PS: can you confirm you were on 2.8.2 (not 2.8.20) when it worked and that upgrading to 2.8.22 broke the plugin?
Reply
#3
Thank you, Ofnuts!
1. Just tested:
* Variant Group worked without trouble in Group Layer (no nesting--haven't needed any yet) for both font and size;
* Variant Siblings 'couldn't pickle': on second thoughs, and after having removed it and restored the other, my own fault; acting by rote, I called it from the parent Group Layer.
As 'old dogs won't learn new tricks', I'd rather stick to the Group variant--please, say if you would have more testing OF BOTH, and I'll zip them and put into the Repository... Smile
2. I was on 2.8.18 when the plugin last worked--at the end of last year. I am under Windows 7--updates for us aren't so frequent--nor do I meet a labeled illustration for an epub every other day.
Many thanks again.
Reply
#4
If you put something on the repository (assuming you still can) people will ask you to maintain it.

I can adopt the script but selecting groups means that you cannot use it to resize layers outside groups, which IMO would be a frequent requirement. Maybe a compromise would be to check the "linked" status of things.

Also, I assume that a nice option would be to keep some specific point of the layers(or of the "bounding box" of the characters in the layers) at the same place? Currently the top right corner is fixed, but I reckon that many people would love to see the center of the layer remain fixed?
Reply
#5
(05-17-2017, 07:19 AM)Ofnuts Wrote: If you put something on the repository (assuming you still can) people will ask you to maintain it.

I can adopt the script but selecting groups means that you cannot use it to resize layers outside groups, which IMO would be a frequent requirement. Maybe a compromise would be to check the "linked" status of things.

Also, I assume that a nice option would be to keep some specific point of the layers(or of the "bounding box" of the characters in the layers) at the same place? Currently the top right corner is fixed, but I reckon that many people would love to see the center of the layer remain fixed?
* Sorry--I didn't explain myself. My meaning: as both versions (Group & Sibling) are incompatible (same register), I thought of keeping BOTH easily available, by putting zipped copies of each in \user\gimp-2.8\plug-ins_storage--if your Add-on Manager allows for such a folder--I have implemented only _storage for seldom used brushes and fonts. As some  font families I could name have incompatibility problems--i.e., drop both xRegular and xBold in \user\gimp-2.8\fonts and xfont comes always bold--an alternative workaround to a font manager is to keep both zipped into \user\gimp-2.8\fonts_storage, and call only one by session. As I say, I have never tested this workaround for plug-ins--but it surely should do?
* Your comments on the advantages of the Siblings version--aren't rather meant for another plug-in (by the same author?--I never got it) to batch resize--offset--and... layers in a group? I think that text layers are peculiar that way, if one wishes to keep them as editable text. Besides changing font and font-size, the only other batch operations I can think of as both safe and useful are
- convert to path  
- set text-alignment (but when text is a label, one usually aligns it more or less to whatever element in the drawing should act as anchor...) 
- set letter-spacing
- set line-spacing
- set hinting
Everything else--fine kerning and adjusting position of layer--seems to ask for human intervention...

Thanks again--my original problem is now solved beautifully!
Reply
#6
The add-on manager doesn't work for plugins. These are only registered when Gimp starts. No too hard to make them distinct:
  • Change the "group_chfont" (first line after "register(")
  • Change the "Change font..." to describe the behavior better
The changes to make it better for the general public are:
  • Select layers with the link icon (it is easy to link everything in two clicks). Linking a group would mean to act on all text layers it contains (with subgroups if recursive).
  • Optionally correct the layer position. Gimp keeps the position of the top left corner of the layer, but in many cases you would like to keep the center of the layer at the same place (or some other corner)
  • For the option above, use either the layer boundary, or a tight-fit rectangle around the text.
  • Other options (spacing, alignment, hinting) are not availabe in the API... 
Edit: actually these other options are in the API, but since Gimp doesn't resize the layer when you change the text characteristics, you have to compute the required layer size yourself and taking these in account is not easy.
Reply
#7
Just a thought, but you could approach from the other direction, change all fonts except those in a folder.

Which is what the Akkana Peckplugin does https://github.com/akkana/gimp-plugins/b...ngefont.py
Reply
#8
As far as I can see, Akkana's script changes everything. I don't see any way to "protect" a folder.
Reply
#9
I do try everything I suggest. This was just looking from a different aspect.

Rather than changing the text in a layer group, change the text outside the layer group. It will mean a bit more work, but I seem to recall plugins that pack/unpack (can't remember the term) layergroups

before http://i.imgur.com/dYyszYt.jpg

after http://i.imgur.com/Vm5nxz3.jpg

The original plugin group_chfont.py does not work in Gimp 2.9.5 either, so it is not only post Gimp 2.8.18
Reply
#10
Oh, I see. Actually, you are just lucky, Akkana's script only deals with top level elements, it won't recursively explore layer groups. Carmen has an interesting approach, she makes groups with the layers that will always have the same size/font, so she just has to designate the group.
Reply


Forum Jump: