From fadf5632e7a9c89524f64a43e8598caba8bb61e9 Mon Sep 17 00:00:00 2001 From: ryanoasis Date: Mon, 16 Nov 2015 15:15:46 -0500 Subject: [PATCH] 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') --- changelog.md | 2 ++ font-patcher | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index d2d0311ad..1f9ccfa55 100644 --- a/changelog.md +++ b/changelog.md @@ -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) diff --git a/font-patcher b/font-patcher index 0f80933e3..57bb42b31 100755 --- a/font-patcher +++ b/font-patcher @@ -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]