shrhdk / text-to-svg

Convert text to SVG path without native dependence.
Other
964 stars 131 forks source link

not support Chinese? #28

Closed xiakehc closed 6 years ago

xiakehc commented 6 years ago

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);

xiakehc commented 6 years ago

image

shrhdk commented 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');
xiakehc commented 6 years ago

thanks! change font can success .