There are deficiencies in the HATCH - related rendering, and the FONT does not wrap.
Some sample file needed. It may be some synthetic minimalistic sample illustrating some particular problem.
Of course, I'm happy to provide them. Here are the drawings with bugs. https://aigc-1364883968.cos.ap-guangzhou.myqcloud.com/aigc/2025/08/05/00971c0ae2844f0dab39832f2058b4f0.dxf
Complex hatch wont stable render due to unstable tesseltaion. earcut that used for tesselation not handle a lot of cases when fill contours intersected or collinear themself, or when one of point included in more that 1 contour.
For that i use tess2 ( GNU TESS implementation)
@hqbHawke You can check my fork and if ok i going to make PR.
https://github.com/eXponenta/dxf-viewer/
Sample:
Source: complex.zip
About mtext: its to hard stable resolve mtext wrapping in Japanese/Chinese/Hundi and all Arabic languages due to hieroglyphics and ligatures. Only browser know layout rules for that languages. This is because when you decompose non-ASCII based text it can be broken ( ligatures and hieroglyphics is 2+ byte long and if you split one then you may got 2 another different characters)
@hqbHawke
The analysis of "hatch" seems correct. For the mtext entity, there will be a font width corresponding to 40 in the parsed result. We can recognize this width to achieve automatic line wrapping. I have made adjustments based on your work, and now it can be parsed normally. You can try this approach
@eXponenta
@hqbHawke Yep, encoding existing in document header. There are a way got it before parsing stage and redecode file in new code page.
This require rewrite DXFFetcher and insert to it validation pass.
Currently DXFFetcher always read files as utf-8. By spec a DXF greater than 2004 is always utf-8. Can you check that ezdxf also parse it correctly)?
https://ezdxf.readthedocs.io/en/stable/dxfinternals/fileencoding.html