Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTEXT rendering bug in drawing add-on #749

Closed
IvanKachaikinCendas opened this issue Oct 2, 2022 · 2 comments
Closed

MTEXT rendering bug in drawing add-on #749

IvanKachaikinCendas opened this issue Oct 2, 2022 · 2 comments

Comments

@IvanKachaikinCendas
Copy link

IvanKachaikinCendas commented Oct 2, 2022

For the DXF below, the very simple code taken from ezdxf docs never ends even though the DXF has only one entity (I intentionally left only one that there is an issue for).

Information and data needed to reproduce the error:

  1. A simplified Python script which triggers the error.
from ezdxf import readfile
from ezdxf.addons.drawing import matplotlib

drawing = readfile('buggy_mtext.dxf')
matplotlib.qsave(drawing.modelspace(), 'test.png')
  1. Information about the ezdxf version and the OS: happens on Windows 11, MacOS and Ubuntu 20.04. ezdxf version tested: 0.18.1, and the following project state: https://github.com/mozman/ezdxf/tree/d4084178c1b43f452188f9f05ad5c45df19cdae5
  2. You may find a problematic DXF in an archive here: buggy_mtext.zip

Expected behaviour: ezdxf exports an image, or throws an exception that the export is not possible.

Important: after some personal investigation, I am pretty sure that the loop in ezdxf/tools/text_layout.py, line 960 becomes infinitive for this plan, but to be honest have no guess how to fix it.

Thanks a lot for taking this issue into account, and do not hesitate to let me know if you need more details about this bug! :)

@mozman
Copy link
Owner

mozman commented Oct 2, 2022

The fix solves the infinite loop, but the rendering of the MLEADER content (a MTEXT entity) does not look like expected.

The current implementation of the MTEXT renderer can handle tabulators just in some rare cases, therefore tabulators should be avoided or at least the text after the tabulator should fit into the line. Keep it simple!

@IvanKachaikinCendas
Copy link
Author

@mozman Ok sounds really great, thanks for you quick feedback!🙂

To be honest with you I'm not an author of the plan where this entity appears, so any unexpected export result is acceptable. The most important is that it isn't infinitive no more🤩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants