purplebamboo / font-carrier

font-carrier是一个功能强大的字体操作库,使用它你可以随心所欲的操作字体。让你可以在svg的维度改造字体的展现形状。
http://purplebamboo.github.io/font-carrier/
MIT License
1.61k stars 194 forks source link

not conrect in function 'function toUnicode(str)' #68

Open peacess opened 8 months ago

peacess commented 8 months ago

下面的代码运行不正常: import FontCarrier from 'font-carrier'; const t = FontCarrier.transfer('t.ttf'); const s = '𠀀'; const newFont = t.min(s); newFont.get(s) === undefined;

出错的原因在函中 function toUnicode(str) { var uArray = [] var u = str2unicode(str)// 这一行不正确, 因为'𠀀'字符用utf-16时是4bytes,不是通常的2bytes .... }