You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is somewhat a feature request more than an issue really as I guess I'm attempting something a bit borderline here. According to OpenSCAD docs one should be able to use fonts "importing" them like: use <ttf/super-font/my-super-font-in-italics.ttf>
However, attempting such thing through SP via solid.use() does not work.
Traceback (most recent call last):
File "/tmp/test/venv/lib/python3.9/site-packages/solid/objects.py", line 856, in use
contents = scad_file_path.read_text()
File "/usr/lib/python3.9/pathlib.py", line 1256, in read_text
returnf.read()
File "/usr/lib/python3.9/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 16: invalid start byteDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/tmp/src/test.py", line 15, in <module> sp.use("../aux/awesome-font-bold.ttf") File "/tmp/test/venv/lib/python3.9/site-packages/solid/objects.py", line 858, in use raise Exception(f"Failed to import SCAD module '{scad_file_path}' with error: {e} ")Exception: Failed to import SCAD module '../aux/awesome-font-bold.ttf' with error: 'utf-8' codec can't decode byte 0x92 in position 16: invalid start byte
Hm. So in this situation, the correct SolidPython translation would be just to pass through a use <PATH.*tf> string?
I'm not in love with that design choice on OpenSCAD's part ("Let's just use use<> for any interaction with the filesystem!"), but SolidPython's is not to reason why.
I think this is an entirely reasonable feature to request and I think it's probably pretty straightforward to add. My work is a little crazy at the moment so this may not happen right away, but I'll look to take care of this in the next release. Thanks for submitting!
Activity
etjones commentedon Feb 22, 2021
Hm. So in this situation, the correct SolidPython translation would be just to pass through a
use <PATH.*tf>string?I'm not in love with that design choice on OpenSCAD's part ("Let's just use
use<>for any interaction with the filesystem!"), but SolidPython's is not to reason why.I think this is an entirely reasonable feature to request and I think it's probably pretty straightforward to add. My work is a little crazy at the moment so this may not happen right away, but I'll look to take care of this in the next release. Thanks for submitting!
[-]use() functionaly to import fonts[/-][+]use() functionality to import fonts[/+]added use <font.ttf/otf> support (SolidCode#165)
added ScadInterface (SolidCode#181, SolidCode#180, SolidCode#178, Sol…