using EZDXF to output PNG images, Chinese characters cannot be displayed normally #1143
-
EZDXF is really useful for automating the generation of CAD drawings! When the generated DXF file is opened in AutoCAD, Chinese characters can be displayed normally. However, when using EZDXF to output PNG images, Chinese characters cannot be displayed normally. What should I do |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The problem has been solved. I hope it will be helpful to future guys. doc.styles.add('myChineseStyle', font=font_path) |
Beta Was this translation helpful? Give feedback.
-
see also #1032 |
Beta Was this translation helpful? Give feedback.
The problem has been solved. I hope it will be helpful to future guys.
The reason is that AutoCAD replaces fonts that are not available with usable fonts, so Chinese can be displayed normally in AutoCAD, but ezdxf does not have this operation.
When using ezdxf and adding Chinese, it is necessary to specify the arialuni.ttf font, and the operating system should also install this font. When exporting PNG images, Chinese can be displayed normally.
doc.styles.add('myChineseStyle', font=font_path)
dim = msp.add_aligned_dim(p1=pos_mid, p2=pos_end, distance=5.0, text=name,
override={'dimtxsty': 'myChineseStyle', "dimtxt": 200,…