Describe the bug
Trying to draw a DXF file fails with a ValueError("invalid width, no usable space left"):
loading file "mtext_empty.dxf"...
findfont: Font family ['dgn000'] not found. Falling back to DejaVu Sans.
Traceback (most recent call last):
File "/home/vscode/.local/bin/ezdxf", line 8, in <module>
sys.exit(main())
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/__main__.py", line 98, in main
run(args)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/commands.py", line 390, in run
frontend.draw_layout(layout, finalize=True)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/frontend.py", line 242, in draw_layout
self.draw_entities(
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/frontend.py", line 259, in draw_entities
_draw_entities(self, self.ctx, entities, filter_func=filter_func)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/frontend.py", line 1030, in _draw_entities
frontend.draw_entity(entity, properties)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/frontend.py", line 278, in draw_entity
draw_method(entity, properties)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/frontend.py", line 359, in draw_mtext_entity
self.draw_complex_mtext(mtext, properties)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/frontend.py", line 372, in draw_complex_mtext
complex_mtext_renderer(self.ctx, self._designer, mtext, properties)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/addons/drawing/mtext_complex.py", line 185, in complex_mtext_renderer
layout_engine = cmr.layout_engine(mtext)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/render/abstract_mtext_renderer.py", line 294, in layout_engine
append_paragraph()
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/render/abstract_mtext_renderer.py", line 245, in append_paragraph
layout.append_paragraphs([paragraph])
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/tools/text_layout.py", line 1265, in append_paragraphs
remainder = column.append_paragraphs(remainder)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/tools/text_layout.py", line 1135, in append_paragraphs
paragraph.set_total_width(self.content_width)
File "/home/vscode/.local/lib/python3.10/site-packages/ezdxf/tools/text_layout.py", line 873, in set_total_width
raise ValueError("invalid width, no usable space left")
ValueError: invalid width, no usable space left
To Reproduce
ezdxf draw mtext_empty.dxf
Version info:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ python -VV
Python 3.10.9 (main, Jan 23 2023, 22:32:48) [GCC 10.2.1 20210110]
$ pip show ezdxf
Name: ezdxf
Version: 1.0.1
Summary: A Python package to create/manipulate DXF drawings.
Home-page: https://ezdxf.mozman.at
Author: Manfred Moitzi
Author-email: me@mozman.at
License: MIT License
Location: /home/vscode/.local/lib/python3.10/site-packages
Requires: pyparsing, typing-extensions
Required-by:
Please find attached simplified mtext_empty.dxf.zip DXF that triggers the error:
mtext_empty.dxf.zip
Expected behavior
Drawing would appear with empty mtext like with QCAD:

Describe the bug
Trying to draw a DXF file fails with a
ValueError("invalid width, no usable space left"):To Reproduce
Version info:
Please find attached simplified
mtext_empty.dxf.zipDXF that triggers the error:mtext_empty.dxf.zip
Expected behavior

Drawing would appear with empty mtext like with QCAD: