Last active
July 28, 2022 15:48
-
-
Save arrowtype/ba698ee306861a81f4de310a4971c539 to your computer and use it in GitHub Desktop.
Several useful spacing & kerning strings, plus a simple way to make your own!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple way to make some kerning strings, for kerning and/or proofing your kerning. | |
Change the "side1Names" to glyphs you want on the left side of pairs, and change side2Names to glyphs you want on the right side of pairs. | |
INSTRUCTIONS: | |
1. Copy space-separated list(s) of glyph names from a font editor, then paste into side1Names and side2Names below | |
- In GlyphsApp, select the glyphs you want, right-click (or control-click) and select Copy Glyph Names > Space Separated | |
- In RoboFont, select the glyphs you want, then press OPTION + COMMAND + C | |
2. Paste those names in the glyphNames variable below, between the quotes | |
3. Run this script. | |
- You could copy & paste it into the Glyphs Macro Panel or the RoboFont Script Window, then run it. | |
- You could alternatively run this anywhere else on your system that runs Python. | |
4. Copy the output text, then paste that into your font editor. | |
5. Kern away! | |
By default, this makes a permutation list of non-flat sided uppercase glyphs, A–Z. | |
You might instead wish to do things like: | |
- Basic letters and basic trailing punctuation: | |
- side1Names = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z" | |
- side2Names = "period comma question quotesingle quoteright colon semicolon" | |
- Basic letters and basic leading punctuation: | |
- side1Names = "period questiondown quotesingle quoteleft quoteright" | |
- side2Names = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z" | |
- Uppercase diagonals (and glyphs with irregular sides): | |
- side1Names = "A F J K L T V W X Y" | |
- side2Names = "A F J K T V W X Y" | |
- Uppercase against lowercase: | |
- side1Names = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" | |
- side2Names = "a b c d e f g h i j k l m n o p q r s t u v w x y z" | |
- Uppercase "overhanging glyphs" against lowercase diacritics: | |
- side1Names = "F T V W Y" | |
- side2Names = "a aacute abreve acircumflex adieresis agrave amacron aogonek aring atilde ae b c cacute ccaron ccedilla d eth dcaron dcroat e eacute ecaron ecircumflex edieresis edotaccent egrave emacron eogonek f g gcommaaccent h i idotless iacute icircumflex idieresis igrave ij imacron iogonek j jdotless k kcommaaccent l lacute lcaron lcommaaccent lslash m n nacute ncaron ncommaaccent ntilde o oacute ocircumflex odieresis ograve ohungarumlaut omacron oslash otilde oe p thorn q r racute rcaron rcommaaccent s sacute scaron scedilla germandbls t tcaron tcedilla u uacute ucircumflex udieresis ugrave uhungarumlaut umacron uogonek uring v w wacute wcircumflex wdieresis wgrave x y yacute ycircumflex ydieresis ygrave z zacute zcaron zdotaccent" # etc ... or maybe be logical and only use pairs that exist in the real world (requires research)! | |
- Non-flat sided uppercase glyphs, A–Z. | |
- side1Names = "A B C D E F G I J K L O P Q R S T U V W X Y Z" | |
- side2Names = "A C G I J O Q S T U V W X Y Z" | |
Etcetera! This is basically just a (very) simplified version of something like MetricsMachine’s pair list builder (without | |
several of its useful options, like compressing groups or adding open/closing punctuation). But, this approach | |
can be still be handy for proofing, working in GlyphsApp, and more! | |
""" | |
# space-separate list of glyph names for glyphs you want on the left side of pairs | |
side1Names = "A F J K L T V W X Y" | |
# space-separate list of glyph names for glyphs you want on the right side of pairs | |
side2Names = "A F J K T V W X Y" | |
# configure the kerning string patter, if you want to adjust it. side1 glyphs will replace $1, and side2 glyphs will replace $2. | |
# add "\\n" at the end of your pattern if you want your output to include newlines, e.g. for the RoboFont space center | |
pattern = f"HH$1$2HO$1$2OO nn$1$2no$1$2oo" | |
for glyphSide1 in side1Names.split(" "): | |
for glyphSide2 in side2Names.split(" "): | |
print(pattern.replace("$1",f"/{glyphSide1} ").replace("$2",f"/{glyphSide2} ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple way to make an arbitrary spacing string. | |
INSTRUCTIONS: | |
1. Copy a space-separated list of glyph names from a font editor | |
- In GlyphsApp, select the glyphs you want, right-click (or control-click) and select Copy Glyph Names > Space Separated | |
- In RoboFont, select the glyphs you want, then press OPTION + COMMAND + C | |
2. Paste those names in the glyphNames variable below, between the quotes | |
3. Run this script. | |
- You could copy & paste it into the Glyphs Macro Panel or the RoboFont Script Window, then run it. | |
- You could alternatively run this anywhere else on your system that runs Python. | |
4. Copy the output text, then paste that into your font editor. | |
5. Space away! | |
""" | |
# copy these from your font editor as space-seperated glyph names | |
glyphNames = "period comma colon semicolon ellipsis exclam exclamdown question questiondown periodcentered bullet asterisk numbersign slash backslash" | |
for name in glyphNames.split(" "): | |
print(f"HH/{name} HHOO/{name} OO") # space glyphs between HH and OO | |
print(f"nn/{name} nnoo/{name} oo") # space glyphs between nn and oo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnnooonono | |
nnannooaoo | |
nnbnnooboo | |
nncnnoocoo | |
nndnnoodoo | |
nnennooeoo | |
nnfnnoofoo | |
nngnnoogoo | |
nnhnnoohoo | |
nninnooioo | |
nnjnnoojoo | |
nnknnookoo | |
nnlnnooloo | |
nnmnnoomoo | |
nnnnnoonoo | |
nnonnooooo | |
nnpnnoopoo | |
nnqnnooqoo | |
nnrnnooroo | |
nnsnnoosoo | |
nntnnootoo | |
nnunnoouoo | |
nnvnnoovoo | |
nnwnnoowoo | |
nnxnnooxoo | |
nnynnooyoo | |
nnznnoozoo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HHH0000HHH | |
HH0HH00000 | |
HH1HH00100 | |
HH2HH00200 | |
HH3HH00300 | |
HH4HH00400 | |
HH5HH00500 | |
HH6HH00600 | |
HH7HH00700 | |
HH8HH00800 | |
HH9HH00900 | |
0123456789 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HH/period HHOO/period OO | |
HH/comma HHOO/comma OO | |
HH/colon HHOO/colon OO | |
HH/semicolon HHOO/semicolon OO | |
HH/ellipsis HHOO/ellipsis OO | |
HH/exclam HHOO/exclam OO | |
HH/exclamdown HHOO/exclamdown OO | |
HH/question HHOO/question OO | |
HH/questiondown HHOO/questiondown OO | |
HH/periodcentered HHOO/periodcentered OO | |
HH/bullet HHOO/bullet OO | |
HH/asterisk HHOO/asterisk OO | |
HH/numbersign HHOO/numbersign OO | |
HH/slash HHOO/slash OO | |
HH/backslash HHOO/backslash OO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HHAHHOOAOO | |
HHBHHOOBOO | |
HHCHHOOCOO | |
HHDHHOODOO | |
HHEHHOOEOO | |
HHFHHOOFOO | |
HHGHHOOGOO | |
HHHHHOOHOO | |
HHIHHOOIOO | |
HHJHHOOJOO | |
HHKHHOOKOO | |
HHLHHOOLOO | |
HHMHHOOMOO | |
HHNHHOONOO | |
HHOHHOOOOO | |
HHPHHOOPOO | |
HHQHHOOQOO | |
HHRHHOOROO | |
HHSHHOOSOO | |
HHTHHOOTOO | |
HHUHHOOUOO | |
HHVHHOOVOO | |
HHWHHOOWOO | |
HHXHHOOXOO | |
HHYHHOOYOO | |
HHZHHOOZOO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment