Replaced String.prototype.normalize with library unorm.

This commit is contained in:
be5invis 2015-09-13 14:37:38 +08:00
parent 96c1551b85
commit ba2834ce5d
4 changed files with 6 additions and 4 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@ node_modules
.settings .settings
.vscode
# Special # Special
*.ttf *.ttf

View File

@ -3,7 +3,7 @@
local font.features (.) local font.features (.)
# Build accented glyphs # Build accented glyphs
define unorm : require 'unorm'
define [isAboveMark mark] : mark && mark.anchors && mark.anchors.above && mark.anchors.above.type === MARK define [isAboveMark mark] : mark && mark.anchors && mark.anchors.above && mark.anchors.above.type === MARK
define customDecompositions ( define customDecompositions (
@ -149,7 +149,7 @@ define [decideName namingParts parts code] : begin {
foreach code [range 0x0000 0xFFFF] : if [not unicodeGlyphs`code] : begin { foreach code [range 0x0000 0xFFFF] : if [not unicodeGlyphs`code] : begin {
local str : String.fromCharCode code local str : String.fromCharCode code
local nfd : fallback customDecompositions.(str) : str.normalize 'NFD' local nfd : fallback customDecompositions.(str) : unorm.nfd str
if [nfd.length > 1] : begin { if [nfd.length > 1] : begin {
local parts () local parts ()
local allFound true local allFound true

View File

@ -7,6 +7,7 @@
"bezier-js" : "*", "bezier-js" : "*",
"yargs" : "*", "yargs" : "*",
"libspiro-js" : ">=0.2.1", "libspiro-js" : ">=0.2.1",
"toml": ">=2.3.0" "toml": ">=2.3.0",
"unorm": ">=1.4.1"
} }
} }