I would like to write a text with a custom ttf on a dxf using ezdxf.
I tried using doc.styles.new('custom_font', dxfattribs={'font' : 'myFont.ttf'})
to load the ttf file (which is in the same folder as my script), but it doesn't work.
My code:
import ezdxf
doc = ezdxf.new('R12', setup=True)
msp = doc.modelspace()
doc.styles.new('custom_style', dxfattribs={'font': 'myFont.ttf'})
text_to_export = ex.text_to_export.text()
msp.add_text(text_to_export,
dxfattribs={
'style': "custom_style",
'height': 0.35}
).set_pos((2, 6), align='LEFT')
doc.saveas("text.dxf")