Merge remote-tracking branch 'gaplo917/master'

This commit is contained in:
B. Kelly 2020-03-13 17:00:15 -04:00 committed by B. Kelly
commit 258773ce22
2 changed files with 34 additions and 2 deletions

31
char_dict.py Normal file
View File

@ -0,0 +1,31 @@
char_dict = {
'ampersand': '&',
'asciicircum': '^',
'asciitilde': '~',
'asterisk': '*',
'backslash': '\\',
'bar': '|',
'colon': ':',
'equal': '=',
'exclam': '!',
'greater': '>',
'hyphen': '-',
'less': '<',
'numbersign': '#',
'percent': '%',
'period': '.',
'plus': '+',
'question': '?',
'semicolon': ';',
'slash': '/',
'underscore': '_',
'at': '@',
'braceleft': '{',
'braceright': '}',
'bracketleft': '[',
'bracketright': ']',
'dollar': '$',
'parenleft': '(',
'parenright': ')',
'w': 'w',
}

View File

@ -16,6 +16,7 @@ from os import path
import sys
from ligatures import ligatures
from char_dict import char_dict
# Constants
COPYRIGHT = '''
@ -108,7 +109,7 @@ class LigatureCreator(object):
self.font.selection.none()
self.font.selection.select(char)
self.font.paste()
self.correct_character_width(self.font[char])
self.correct_character_width(self.font[ord(char_dict[char])])
def correct_ligature_width(self, glyph):
"""Correct the horizontal advance and scale of a ligature."""
@ -161,7 +162,7 @@ class LigatureCreator(object):
# We assume here that this is because char is a single letter
# (e.g. 'w') rather than a character name, and the font we're
# editing doesn't have glyphnames for letters.
self.font[ord(char)].glyphname = char
self.font[ord(char_dict[char])].glyphname = char
if i < len(input_chars) - 1:
self.font.createChar(-1, cr_name(i))