SolidCode / SolidPython

A python frontend for solid modelling that compiles to OpenSCAD
1.1k stars 171 forks source link

Japanese text became crash when generate scad file #200

Closed potty26 closed 1 year ago

potty26 commented 1 year ago

japanese text became crash when using text(). I can't find any solution. Thank you for your help.

pyfile_CrushJapaneseText Scadfile_CrushJapaneseText

jeff-dh commented 1 year ago

[deleted] too quick reply too early in the morning.... sorry

jeff-dh commented 1 year ago

buuut, it still seems to work on my system (assuming my input is some japanese text):

>>> from solid import *
>>> t = text("日本語", font="Yu Gothic UI:style=Bold", size=20)
>>> l = linear_extrude(10)(t)
>>> scad_render(t)
'\n\ntext(font = "Yu Gothic UI:style=Bold", size = 20, text = "日本語");'
>>> 

Is this probably not a solidpython but a issue concerning your system? Is japanese text working in python on your system otherwise?

potty26 commented 1 year ago

Also execute "scad_render(l)" and can execute correctly.

scad_render(l) '\n\nlinear_extrude(height = 10) {\n\ttext(font = "Yu Gothic UI:style=Bold", size = 20, text = "日本語");\n}'

But when execute "scad_render_to_file(l,"test.scad")" , generated file was crushed.

scad_render_to_file(l,"test.scad") 'C:/Users/81905/test.scad'

スクリーンショット 2022-11-20 092049

jeff-dh commented 1 year ago

Works fine on my system:

// Generated by SolidPython 1.1.1 on 2022-11-20 09:35:41

linear_extrude(height = 10) {
    text(font = "Yu Gothic UI:style=Bold", size = 20, text = "日本語");
}
/***********************************************
*********      SolidPython code:      **********
************************************************

from solid import *

t = text("日本語", font="Yu Gothic UI:style=Bold", size=20)
l = linear_extrude(10)(t)
scad_render_to_file(l)

************************************************/