From 67411ec691ade8133e97deaeb83f252fd0e929d4 Mon Sep 17 00:00:00 2001 From: Kevin Martin Date: Mon, 20 Mar 2023 11:48:47 -0400 Subject: [PATCH] Issue 8968: Correct C++ DXF importer to get all of long MTEXT text If the MTEXT exceeds 250 characters, the contents are broken up into several records in the DXF file. The C++ importer has been changed to collect all these pieces into a single string containing all the text. --- src/Mod/Import/App/dxf/dxf.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Mod/Import/App/dxf/dxf.cpp b/src/Mod/Import/App/dxf/dxf.cpp index bd84721cb6..b20d39b837 100644 --- a/src/Mod/Import/App/dxf/dxf.cpp +++ b/src/Mod/Import/App/dxf/dxf.cpp @@ -2361,6 +2361,7 @@ bool CDxfRead::ReadText() { double c[3]; // coordinate double height = 0.03082; + std::string textPrefix; memset( c, 0, sizeof(c) ); @@ -2403,11 +2404,22 @@ bool CDxfRead::ReadText() get_line(); ss.str(m_str); ss >> height; height = mm(height); if(ss.fail()) return false; break; + case 3: + // Additional text that goes before the type 1 text + get_line(); + textPrefix.append(m_str); + break; case 1: // text + // Note that we treat this as the end of the TEXT or MTEXT entity but this may cause us to miss + // other properties. Officially the entity ends at the start of the next entity, the BLKEND record + // that ends the containing BLOCK, or the ENDSEC record that ends the ENTITIES section. These are + // all code 0 records. Changing this would require either some sort of peek/pushback ability or the understanding + // that ReadText() and all the other Read... methods return having already read a code 0. get_line(); DerefACI(); - OnReadText(c, height * 25.4 / 72.0, m_str); + textPrefix.append(m_str); + OnReadText(c, height * 25.4 / 72.0, textPrefix.c_str()); return(true); case 62: