Is there a way to scale kerning values for a selected subset of glyphs? (I used transform>scale to reduce size of my Thai and Lao glyphs, but the kerning values do not seem to have been included in the transformation.)
If you use RMX Scaler it does scale the kerning values. It does need two masters, but I think you can hack it if you have only one if you duplicate it and just change the stems values. (I am not sure if this is the right way to do it, but it seems to be working).
You can try something like this:
scaleFactor = 0.6 search = "thai" for fontmaster in Font.masters: mID = fontmaster.id masterKerning = Font.kerning[mID] for leftSide in masterKerning.keys(): for rightSide in masterKerning[leftSide].keys(): if search in leftSide or search in rightSide or search in Font.glyphForId_(leftSide).name or search in Font.glyphForId_(rightSide).name: masterKerning[leftSide][rightSide] *= scaleFactor
Careful, the view does not update immediately, you may have to close and reopen a tab. This assumes that the word “thai” is also in the kerning group names.
Maybe better: Look for all selected glyphs, record their
id properties and their group names in a list, and then check every kerning pair against that list, and apply the scale factor if left side or right side is in the list.
Ha, thanks Kostas!
I didn’t use RMX Scaler for this, as I couldn’t figure out what values to input in the ‘weight’ field to scale the stems to 80% thickness (as the x-y transformation was 80%). On my thin master, that weight field also thickens the stems whether its value is positive or negative, so not much use for this sort of thing unfortunately.
Thanks Rainer! I’ll give this a go. I think the glyphs all have ‘thai’ (or ‘lao’) in the name as I’ve been able to use Georg’s naming scheme on this one. Your script might just save me from faffing around with CSV exports, thanks!
In that case use MetricsMachine and a wildcard search to transform the values.
Thanks, but I don’t have Metrics Machine.
I also tried Rainer’s ‘adjust kerning in master’ script, but got this error:
Nothing, my code was not failsafe. It should check whether leftSide and rightSide are group names or glyph ids. I’ll see what I can do.
Possible that I need to update the script for the current API. I’ll have a look.
Adjust Kerning in Master work fine for me in v.2.3. Make sure you have the latest version of the script, perhaps also reinstall the modules in Preferences > Addons > Modules.
And the script should look like this. Note where I check for what actually is the left/rightSide: If it does not start with an at sign, it is not a group, and therefore must be a glyph id, so I get the name of the glyph and put it into left/rightSide instead.
scaleFactor = 0.6 search = "thai" for fontmaster in Font.masters: mID = fontmaster.id masterKerning = Font.kerning[mID] for leftSide in masterKerning.keys(): for rightSide in masterKerning[leftSide].keys(): if not leftSide.startswith("@"): # not a group, but a single glyph leftSide = Font.glyphForId_(leftSide).name if not rightSide.startswith("@"): # not a group, but a single glyph rightSide = Font.glyphForId_(rightSide).name if search in leftSide or search in rightSide: masterKerning[leftSide][rightSide] *= scaleFactor