summaryrefslogtreecommitdiff
path: root/lib/lettering
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lettering')
-rw-r--r--lib/lettering/font.py4
-rw-r--r--lib/lettering/font_variant.py4
-rw-r--r--lib/lettering/glyph.py2
3 files changed, 7 insertions, 3 deletions
diff --git a/lib/lettering/font.py b/lib/lettering/font.py
index d1ed6154..5ae6743a 100644
--- a/lib/lettering/font.py
+++ b/lib/lettering/font.py
@@ -8,6 +8,7 @@ import os
from collections import defaultdict
from copy import deepcopy
from random import randint
+import unicodedata
import inkex
@@ -217,6 +218,9 @@ class Font(object):
"""Render text into an SVG group element."""
self._load_variants()
+ # Normalize the text in the same way that glyph names are normalized (NFC)
+ text = unicodedata.normalize('NFC', text)
+
if variant is None:
variant = self.default_variant
diff --git a/lib/lettering/font_variant.py b/lib/lettering/font_variant.py
index 4862b00b..80d9d3e6 100644
--- a/lib/lettering/font_variant.py
+++ b/lib/lettering/font_variant.py
@@ -74,7 +74,7 @@ class FontVariant(object):
for layer in glyph_layers:
self._clean_group(layer)
layer.attrib[INKSCAPE_LABEL] = layer.attrib[INKSCAPE_LABEL].replace("GlyphLayer-", "", 1)
- glyph_name = normalize('NFKC', layer.attrib[INKSCAPE_LABEL])
+ glyph_name = normalize('NFC', layer.attrib[INKSCAPE_LABEL])
try:
self.glyphs[glyph_name] = Glyph(layer)
except (AttributeError, ValueError):
@@ -144,7 +144,7 @@ class FontVariant(object):
# binding glyph only have two shapes, isol and fina
non_binding_char = ['ا', 'أ', 'ﺇ', 'آ', 'ٱ', 'د', 'ذ', 'ر', 'ز', 'و', 'ؤ']
- normalized_non_binding_char = [normalize('NFKC', letter) for letter in non_binding_char]
+ normalized_non_binding_char = [normalize('NFC', letter) for letter in non_binding_char]
return not (character in normalized_non_binding_char)
def is_mark(self, character):
diff --git a/lib/lettering/glyph.py b/lib/lettering/glyph.py
index fd1e1985..98f69ecb 100644
--- a/lib/lettering/glyph.py
+++ b/lib/lettering/glyph.py
@@ -39,7 +39,7 @@ class Glyph(object):
self.name = group.label
if len(self.name) > 11:
- self.name = normalize('NFKC', self.name[11:])
+ self.name = normalize('NFC', self.name[11:])
self._process_baseline(group.getroottree().getroot())
self.clips = self._process_clips(group)
self.node = self._process_group(group)