Created
June 12, 2013 11:47
-
-
Save gferreira/5764612 to your computer and use it in GitHub Desktop.
simple accent builder
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
# [h] simple accent builder | |
# functions | |
def build_glyph(font, glyph_name, accents_dict, verbose=True): | |
if accents_dict.has_key(glyph_name): | |
if verbose: | |
print 'building %s...' % glyph_name | |
base_glyph, accents = accents_dict[glyph_name] | |
font.removeGlyph(glyph_name) | |
font.compileGlyph(glyph_name, base_glyph, accents) | |
font[glyph_name].update() | |
else: | |
if verbose: | |
print '# no entry for %s' % glyph_name | |
# accents data | |
accents_dict = { | |
# add your glyph composition recipes here. | |
# composed_glyph : [ base_glyph, ( (accent1, anchor1), (accent2, anchor2), ... ) ], | |
'aogonek' : [ 'a', ( ('ogonek', 'bottom'), ) ], | |
'agrave' : [ 'a', ( ('grave', 'top'), ) ], | |
'ccedilla' : [ 'c', ( ('cedilla', 'bottom'), ) ], | |
} | |
# build accents | |
f = CurrentFont() | |
for glyph_name in f.selection: | |
build_glyph(f, glyph_name, accents_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment