Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPath return partial data and serie of NaN #22

Closed
edouard-lopez opened this issue Mar 31, 2017 · 1 comment
Closed

getPath return partial data and serie of NaN #22

edouard-lopez opened this issue Mar 31, 2017 · 1 comment

Comments

@edouard-lopez
Copy link

edouard-lopez commented Mar 31, 2017

related: #23

Env

Code

import TextToSVG from "text-to-svg";

const textToSVG = TextToSVG.loadSync(
  "./resources/fonts/NotoSansTC-Regular.otf"
);
const svg = textToSVG.getSVG("yǐn");
console.log(svg);

Output:

$ node --require babel-core/register ./debug.js 
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="101.30400000000002" height="106.56000000000002"><path d="M0-7.13L4.61-7.13L4.61-13.68C8.57 3.67 4.82NaNNaNNaNLNaNNaNLNaNNaNLNaNNaN"/></svg>

Error

Above is a short snippet that reproduce the but, in the context of my app I got more info:

yǐn <path fill="black" stroke="black" id="annotation" d="M39.24 15.98L40.26 15.98L40.26 14.52C41.14 18.38 40.31NaNNaNNaNLNaNNaNLNaNNaNLNaNNaN"/>
already exists
Error: Got an error parsing the glyph "㐆": Unexpected character "N" at index 54..
    at SAXStream.<anonymous> (/data/projects/hanzi-pinyin-font/node_modules/svgicons2svgfont/src/index.js:245:29)
    at emitOne (events.js:96:13)
    at SAXStream.emit (events.js:188:7)
    at Object.me._parser.(anonymous function) [as onopentag] (/data/projects/hanzi-pinyin-font/node_modules/sax/lib/sax.js:258:17)
    at emit (/data/projects/hanzi-pinyin-font/node_modules/sax/lib/sax.js:640:35)
    at emitNode (/data/projects/hanzi-pinyin-font/node_modules/sax/lib/sax.js:645:5)
    at openTag (/data/projects/hanzi-pinyin-font/node_modules/sax/lib/sax.js:841:5)
    at Object.write (/data/projects/hanzi-pinyin-font/node_modules/sax/lib/sax.js:1305:13)
    at SAXStream.write (/data/projects/hanzi-pinyin-font/node_modules/sax/lib/sax.js:239:18)
    at Readable.ondata (_stream_readable.js:555:20)
(node:4788) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'svg' of undefined
Done in 2.25s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant