We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I was trying to print Chinese/Japanese words on my model. But only blank squares are drawn:
I'm pretty sure PIL package supports Chinese font and strings. So I guess there is a problem with sdf implementation.
PIL
from sdf import * base = rectangle((100, 100)).extrude_to( rectangle((100, 100)), 100, ease.linear ) base = base.translate((100 / 2, 100 / 2, 100 / 2)) FONT = "simsunb.ttf" TEXT_ENGLISH = "test" w, h = measure_text(FONT, TEXT_ENGLISH) text_test = ( text(FONT, TEXT_ENGLISH, 8 * (w / h), 8) .extrude(h) .translate((10 + w + 10, 100 / 2, h / 2)) ) text_test = text_test.orient(Y) TEXT_CHINESE = "中文测试" w, h = measure_text(FONT, TEXT_CHINESE) text_error = ( text(FONT, TEXT_CHINESE, 8 * (w / h), 8) .extrude(h) .translate((10 + w + 10, 140 / 2, h / 2)) ) text_error = text_error.orient(Y) f= base | text_test | text_error f.save('out.stl', step=0.1)
OS: win10 Python 3.9.1 sdf version: commit 2a17d2f (HEAD -> main, origin/main, origin/HEAD)
from PIL import Image, ImageDraw, ImageFont image= Image.new('RGB', (559, 320),(255,255,255)) draw = ImageDraw.Draw(image) TEXT_CHINESE = "中文测试" # draw.text() font = ImageFont.truetype("simsun.ttc", 40) draw.text((100, 50), TEXT_CHINESE, fill = 255, font = font) image.show()
output:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I was trying to print Chinese/Japanese words on my model. But only blank squares are drawn:
![Snipaste_2021-07-01_16-01-22](https://user-images.githubusercontent.com/7104870/124088572-a3e2fe00-da85-11eb-890d-e6287be5ef23.png)
I'm pretty sure
PIL
package supports Chinese font and strings. So I guess there is a problem with sdf implementation.sample code
Environment
OS: win10
Python 3.9.1
sdf version: commit 2a17d2f (HEAD -> main, origin/main, origin/HEAD)
Appendix: PIL works fine with Chinese
output:
![PIL_output](https://user-images.githubusercontent.com/7104870/124086112-52d20a80-da83-11eb-80ae-1710ea363b0a.png)
The text was updated successfully, but these errors were encountered: