mozman / ezdxf

Python interface to DXF
https://ezdxf.mozman.at
MIT License
937 stars 191 forks source link

How can I import a custom shx file? #1186

Closed creampnx-x closed 1 month ago

creampnx-x commented 1 month ago

Hi, need help.

Question

I am trying to use ezdxf.odafc to open dwg files drawn with autocad and save them as svg files. However, the files contain existing shx font files. How should I import the font files and export them to svg correctly?

What I have tried

import ezdxf

ezdxf.options.support_dirs = [
    'D:\Fonts' # this Fonts folder has shx files.
]
## ...

 doc.styles.add_shx('font.shx', dxfattribs={'font': 'font.shx'})

The code does not work, what can I do to import shx file and use it?