add load_mtext_content()
@@ -34,7 +34,7 @@ from .fonts import FontMeasurements, AbstractFont, FontFace
if TYPE_CHECKING:
- from ezdxf.eztypes import Text, MText, DXFEntity
+ from ezdxf.eztypes import Text, MText, DXFEntity, Tags
X_MIDDLE = 4 # special case for overall alignment "MIDDLE"
@@ -1622,3 +1622,14 @@ class MTextParser:
def consume_optional_terminator(self):
if self.scanner.peek() == ";":
self.scanner.consume(1)
+
+
+def load_mtext_content(tags: "Tags") -> str:
+ tail = ""
+ content = ""
+ for code, value in tags:
+ if code == 1:
+ tail = value
+ elif code == 3:
+ content += value
+ return escape_dxf_line_endings(content + tail)
