コード例 #1
0
ファイル: test_514_text.py プロジェクト: yening2020/ezdxf
def test_dxf_escape_line_endings():
    assert escape_dxf_line_endings('\\P test') == '\\P test'
    assert escape_dxf_line_endings('abc\ndef') == 'abc\\Pdef'
    assert escape_dxf_line_endings('abc\rdef') == 'abcdef', \
        r"a single '\r' should be ignored"
    assert escape_dxf_line_endings('abc\r\ndef') == 'abc\\Pdef', \
        r"'\r\n' represents a single newline"
コード例 #2
0
ファイル: test_514_text.py プロジェクト: Rahulghuge94/ezdxf
def test_dxf_escape_line_endings():
    assert escape_dxf_line_endings("\\P test") == "\\P test"
    assert escape_dxf_line_endings("abc\ndef") == "abc\\Pdef"
    assert (
        escape_dxf_line_endings("abc\rdef") == "abcdef"
    ), r"a single '\r' should be ignored"
    assert (
        escape_dxf_line_endings("abc\r\ndef") == "abc\\Pdef"
    ), r"'\r\n' represents a single newline"
コード例 #3
0
ファイル: mtext.py プロジェクト: jpsantos-mf/ezdxf
 def export_mtext(self, tagwriter: 'TagWriter') -> None:
     txt = escape_dxf_line_endings(self.text)
     str_chunks = split_mtext_string(txt, size=250)
     if len(str_chunks) == 0:
         str_chunks.append("")
     while len(str_chunks) > 1:
         tagwriter.write_tag2(3, str_chunks.pop(0))
     tagwriter.write_tag2(1, str_chunks[0])
コード例 #4
0
ファイル: mtext.py プロジェクト: jpsantos-mf/ezdxf
 def load_mtext(self, tags: Tags) -> Iterable['DXFTag']:
     tail = ""
     parts = []
     for tag in tags:
         if tag.code == 1:
             tail = tag.value
         elif tag.code == 3:
             parts.append(tag.value)
         else:
             yield tag
     parts.append(tail)
     self.text = escape_dxf_line_endings(caret_decode("".join(parts)))