Hello Tim!
I have started using KO lately and it is amazing!
However some couples are not kerned when one of the glyphs has diacritict (the base glyph is kerned).
In my case, I need to kern elements like ◆■ ‣ • with shapes like V W Y T K L. I set the 1st group as "special kerning" > "spaced-off" and set "auto" for each combination between 1st and 2nd group.
So for instance now W◆W◆ are kerned. But not ẂŴẄẀ. How can I solve it other than manually hit "auto" for each combo?
Thank you in advance for you help :)
No kern for accented letters
- Tim Ahrens
- Site Admin
- Posts: 447
- Joined: 11 Jul 2019
Re: No kern for accented letters
This seems to be a unique use case. Right now, there is no elegant, built-in way of achieving what you want. Maybe I should add a feature that allows to specify user-set autopairs for groups of glyphs.
For now, you can use this code:
Just paste it in to the Macro Panel and push the “Run” button. Then you can select all text in the tab and switch the pairs to Auto.
For now, you can use this code:
Code: Select all
characters_1st = '◆■‣•'
characters_2nd = 'ÁĂÂÄÀĀĄÅÃÆĆČÇĈĎĐÐÉĚÊËĖÈĒĘĞĜĢĤÍÎÏİÌĪĮĨĴĶĹĽĻŁŃŇŅÑÓÔÖÒŐŌØÕŒÞŔŘŚŠŞŜȘŤȚÚŬÛÜÙŰŪŲŮŨẂŴẀÝŶŸỲŹŽŻ'
string = '\n'.join([c1 + c2 for c1 in characters_1st for c2 in characters_2nd])
print(string)
Glyphs.font.currentTab.text = string
Re: No kern for accented letters
Ok thank you! Stupid question... which the syntax is if I need to put into the list a .xxx glyph?
- Tim Ahrens
- Site Admin
- Posts: 447
- Joined: 11 Jul 2019
Re: No kern for accented letters
You can also work with glyph names, with space in-between:
Note that you can select several glyphs, right-click and choose Copy Glyph Names > Space Separated. That’s quite convenient in this case.
Code: Select all
characters_1st = 'f.calt g.calt t.calt f.liga t.low e.ss04'.split()
characters_2nd = 'Aacute Abreve Acircumflex Adieresis Agrave Amacron Aogonek Aring Atilde AE Cacute Ccaron Ccedilla Ccircumflex Dcaron Dcroat Eth Eacute Ecaron Ecircumflex Edieresis Edotaccent Egrave Emacron Eogonek Gbreve Gcircumflex Gcommaaccent Hcircumflex Iacute Icircumflex Idieresis Idotaccent Igrave Imacron Iogonek Itilde Jcircumflex Kcommaaccent Lacute Lcaron Lcommaaccent Lslash Nacute Ncaron Ncommaaccent Ntilde Oacute Ocircumflex Odieresis'
string = '\n'.join( ['/'+c1 + '/'+c2 for c1 in characters_1st for c2 in characters_2nd] )
print( string )
Glyphs.font.currentTab.text = string
Re: No kern for accented letters
Georg helped me with the code. The following syntax will work
font = Glyphs.font
names_1st = ["blackDiamond", "blackSquare", "triangularbullet", "bullet"]
names_2nd = ["A", "Aacute", "Abreve", "Acircumflex", "Adieresis", "Agrave", "Amacron", "Aogonek", "Aring", "Atilde", "AE", "C", "Cacute", "Ccaron", "Ccedilla", "Ccircumflex", "D", "Dcaron", "Dcroat", "Eth", "J", "J.ss02", "Jacute", "Jacute.ss02","Jcircumflex", "Jcircumflex.ss02", "K", "Kcommaaccent", "L", "Lacute", "Lcaron", "Lcommaaccent", "Lslash", "O", "Oacute", "Obreve", "Ocircumflex", "Odieresis", "Odotbelow", "Ograve", "Ohungarumlaut", "Omacron", "Oogonek", "Oslash", "Oslashacute", "Otilde", "T", "Tcaron", "Tcommaaccent", "W", "Wacute", "Wcircumflex", "Wgrave", "Y", "Yacute", "Ycircumflex", "Ydieresis", "Ygrave", "Z", "Zacute", "Zcaron", "Zdotaccent", "k", "kcommaaccent", "racute", "rcaron", "rcommaaccent", "t", "tbar", "tcaron", "tcedilla", "tcommaaccent", "v", "w", "wacute", "wcircumflex", "wdieresis", "wgrave", "x", "y", "y.ss04", "yacute", "yacute.ss04", "ycircumflex", "ycircumflex.ss04", "ydieresis", "ydieresis.ss04", "ygrave", "ygrave.ss04", "ymacron", "ymacron.ss04", "ytilde", "ytilde.ss04", "z", "zacute", "zcaron", "zdotaccent"]
pairs = []
for name1 in names_1st:
glyph1 = font.glyphs[name1]
if not glyph1:
continue
char1 = font.characterForGlyph(glyph1)
for name2 in names_2nd:
glyph2 = font.glyphs[name2]
if not glyph2:
continue
char2 = font.characterForGlyph(glyph2)
pairs.append(chr(char1) + chr(char2) + chr(char1))
string = '\n'.join(pairs)
print(string)
font.currentTab.text = string
font = Glyphs.font
names_1st = ["blackDiamond", "blackSquare", "triangularbullet", "bullet"]
names_2nd = ["A", "Aacute", "Abreve", "Acircumflex", "Adieresis", "Agrave", "Amacron", "Aogonek", "Aring", "Atilde", "AE", "C", "Cacute", "Ccaron", "Ccedilla", "Ccircumflex", "D", "Dcaron", "Dcroat", "Eth", "J", "J.ss02", "Jacute", "Jacute.ss02","Jcircumflex", "Jcircumflex.ss02", "K", "Kcommaaccent", "L", "Lacute", "Lcaron", "Lcommaaccent", "Lslash", "O", "Oacute", "Obreve", "Ocircumflex", "Odieresis", "Odotbelow", "Ograve", "Ohungarumlaut", "Omacron", "Oogonek", "Oslash", "Oslashacute", "Otilde", "T", "Tcaron", "Tcommaaccent", "W", "Wacute", "Wcircumflex", "Wgrave", "Y", "Yacute", "Ycircumflex", "Ydieresis", "Ygrave", "Z", "Zacute", "Zcaron", "Zdotaccent", "k", "kcommaaccent", "racute", "rcaron", "rcommaaccent", "t", "tbar", "tcaron", "tcedilla", "tcommaaccent", "v", "w", "wacute", "wcircumflex", "wdieresis", "wgrave", "x", "y", "y.ss04", "yacute", "yacute.ss04", "ycircumflex", "ycircumflex.ss04", "ydieresis", "ydieresis.ss04", "ygrave", "ygrave.ss04", "ymacron", "ymacron.ss04", "ytilde", "ytilde.ss04", "z", "zacute", "zcaron", "zdotaccent"]
pairs = []
for name1 in names_1st:
glyph1 = font.glyphs[name1]
if not glyph1:
continue
char1 = font.characterForGlyph(glyph1)
for name2 in names_2nd:
glyph2 = font.glyphs[name2]
if not glyph2:
continue
char2 = font.characterForGlyph(glyph2)
pairs.append(chr(char1) + chr(char2) + chr(char1))
string = '\n'.join(pairs)
print(string)
font.currentTab.text = string
- Tim Ahrens
- Site Admin
- Posts: 447
- Joined: 11 Jul 2019
Re: No kern for accented letters
This code should do practically the same but it is more complicated to set up. ;-)
Re: No kern for accented letters
your doesn't work in the sense that for instance outputs:
J
.
s
s
0
2
I have posted it just in case someone else would need it :)
J
.
s
s
0
2
I have posted it just in case someone else would need it :)
- Tim Ahrens
- Site Admin
- Posts: 447
- Joined: 11 Jul 2019
Re: No kern for accented letters
Maybe you omitted the .split() at the end of the first line?
Re: No kern for accented letters
nope, never mind anyway. thanks for the support :)