Copy and scale uppercase kerning to small caps with a script

Ramiro Espinoza
Posts: 839
One more simple Robofab script to copy and scale uppercase kerning to small caps. With the 'factor' variable you can decide how much the kerning should be reduced to better fit small caps.
**Warning**: the resulting kerning will always need manual tweaking. Remember that capitals and small caps have different proportions.
**Warning**: the resulting kerning will always need manual tweaking. Remember that capitals and small caps have different proportions.
#FLM: ReType CopyKerningUC2sc V 1.0 # Copy & scale kerning from UC to sc from robofab.world import CurrentFont font = CurrentFont() kerning = font.kerning left = ['A', 'AE', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'OE', 'P', 'Thorn', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] middle = ['A', 'AE', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'OE', 'P', 'Thorn', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] factor = 10 for A in left: for B in middle: if kerning[A, B] is not None: kerning[str.lower(A)+'.sc', str.lower(B)+'.sc'] = (kerning[A, B]) - factor print 'Klaar!!' font.update()
6
Comments
-
Hey Ramiro, thanks for sharing this. I was thinking about replacing the left/middle list by extracting the font for UC glyphs from .sc glyphnames directly. So it is not necessary to provide a list of UC glyphs. There are exceptions of course like uni names and there are probably smarter solutions, but I just quickly did a small addition. Taking classes/groups into account would be another addition, but no big deal actually.
font = CurrentFont() # collects .sc glyphs in font <div>smallCaps = [name for name in font.keys() if ".sc" in name]</div><div> # makes uppercase from smallcaps </div><div>upperCaseFromSmallCaps = [name.split(".")[0].title() for name in smallCaps if name.split(".")[0].title() in font.keys()]</div><div> # adds some exeptions: e.g. OE / AE / AEacute etc. (glyphsnames were the first 2 chars are Uppercase) </div><div>upperCaseFromSmallCaps.extend([name[0:2].upper()+name[2:].strip(".sc") for name in smallCaps if name[0:2].upper()+name[2:].strip(".sc") in font.keys()])</div><div> left = upperCaseFromSmallCaps middle = upperCaseFromSmallCaps</div>
1
Categories
- All Categories
- 46 Introductions
- 3.8K Typeface Design
- 475 Type Design Critiques
- 555 Type Design Software
- 1.1K Type Design Technique & Theory
- 640 Type Business
- 830 Font Technology
- 29 Punchcutting
- 507 Typography
- 120 Type Education
- 313 Type History
- 74 Type Resources
- 109 Lettering and Calligraphy
- 30 Lettering Critiques
- 79 Lettering Technique & Theory
- 529 Announcements
- 84 Events
- 110 Job Postings
- 165 Type Releases
- 169 Miscellaneous News
- 274 About TypeDrawers
- 54 TypeDrawers Announcements
- 118 Suggestions and Bug Reports