mirror of
https://github.com/ToxicFrog/Ligaturizer.git
synced 2024-10-03 20:57:51 +03:00
fix #73 ord() expected a character.
This commit is contained in:
parent
daa4dc8baf
commit
3d75e1bb9e
31
char_dict.py
Normal file
31
char_dict.py
Normal 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',
|
||||
}
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user