microsoft / maker.js

📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
http://maker.js.org
Apache License 2.0
1.76k stars 269 forks source link

How can I use Chinese in the caption #597

Open hjdbenny opened 2 months ago

hjdbenny commented 2 months ago

Hello. How can I use Chinese garbled characters? For example Chinese .

 var square = new makerjs.models.Square(100);
    square.caption = {
      text: "测试",
      anchor: new makerjs.paths.Line([0, 50], [100, 50])
    };
    square.layer = 'blue';
    let dxf = makerjs.exporter.toDXF(square, { fontSize: 16 });

When exporting DXF in this way, Chinese garbled characters will be displayed Dingtalk_20240725154827

danmarshall commented 2 months ago

Hello, we use the opentype.js library for fonts. Please check their repo's issues list to see if there are any workarounds. It seems not all languages/glyphs are supported. Perhaps we should add an integration with fontkit ?