Closed xiakehc closed 6 years ago
@WPDreamMelody
The default font does not support Chinese. Please specify the chinese font to the constructor.
const TextToSVG = require('text-to-svg');
const textToSVG = TextToSVG.loadSync('chinese-font-file.otf');
thanks! change font can success .
Like this :
const TextToSVG = require('text-to-svg'); const textToSVG = TextToSVG.loadSync();
const attributes = {fill: '#FF6633', stroke: '#FF6633'}; const options = {x: 0, y: 0, fontSize: 44, anchor: 'top', attributes: attributes};
const svg = textToSVG.getSVG('产品经理',options); console.log(svg);