Fixes possible error with '--careful' flag (fixes #45)

* look up slot by unicode, fixes breaking if has careful flag and copying with 'exact encoding' glyph set copying method (e.g. 'Powerline Extra')
This commit is contained in:
ryanoasis 2015-11-16 15:15:46 -05:00
parent fe9e1eef22
commit fadf5632e7
2 changed files with 7 additions and 3 deletions

View file

@ -2,6 +2,8 @@ CHANGELOG
================================================================================
This project is using [Semantic Versioning 2.0.0](http://semver.org/)
- Unreleased/unversioned
- Fixes possible error with '--careful' flag (fixes #45)
- v0.6.0
- Updated Font naming conventions and directory paths that are more manageable (partially fixes #32, #42)
- Updated Font variations to use same Font Family (partially fixes #25, #42)

View file

@ -303,7 +303,7 @@ def copy_glyphs(sourceFont, sourceFontStart, sourceFontEnd, symbolFont, symbolFo
if exactEncoding:
# use the exact same hex values for the source font as for the symbol font
currentSourceFontGlyph = sym_glyph.encoding
copiedToSlot = sym_glyph.glyphname
copiedToSlot = str(sym_glyph.unicode)
else:
# use source font defined hex values based on passed in start and end
# convince that this string really is a hex:
@ -313,8 +313,6 @@ def copy_glyphs(sourceFont, sourceFontStart, sourceFontEnd, symbolFont, symbolFo
if args.quiet == False:
print "updating glyph: " + str(sym_glyph) + " " + str(sym_glyph.glyphname) + " putting at: " + str(copiedToSlot)
# Prepare symbol glyph dimensions
sym_dim = get_dim(sym_glyph)
@ -324,6 +322,10 @@ def copy_glyphs(sourceFont, sourceFontStart, sourceFontEnd, symbolFont, symbolFo
# check it
if args.careful:
if copiedToSlot.startswith("uni"):
copiedToSlot = copiedToSlot[3:]
codepoint = int("0x" + copiedToSlot, 16)
try:
sourceFont[codepoint]