A STYLE record names the font and proportions text is drawn with: Width is the width of the letters over their height and Oblique their slant, in degrees. A Height of 0, the default, lets each text give its own.
A TEXT is one line in one style, Standard unless it names another. Left on its baseline, the default, it starts at Lettering.Position; Height is the height of its letters in drawing units.
Lettering.Horizontal takes 0 left, 1 center, 2 right or 4 middle, and the text’s own Vertical 0 baseline, 1 bottom, 2 middle or 3 top. Each of these but left on the baseline holds the text to Lettering.Alignment. Position is then where the drawn text starts, which depends on the font and which dxfio does not work out, so these texts give it the alignment point too.
An MTEXT wraps its text in a frame Width wide, its Attachment point, top left by default, at Position. Its fields are in Paragraph, kept on the heap and reached with ->. A value of any length goes in Value whole: dxfio writes it in pieces of 250 characters.
C++
DxfIO::Entities::MText note{};note.Paragraph->Position = {.X = 0, .Y = 50, .Z = 0};note.Paragraph->Height = 2.5;note.Paragraph->Width = 40;note.Paragraph->Value = R"(Pump P-1 feeds {\C1;tank 3} through valve V-12, open in service\PDrain before winter)";DxfIO::Edit::Add(drawing, note);
The codes are in the text itself. Saved to R12, which has no MTEXT, the note becomes plain TEXT, a new one only where the note breaks its own line and not where its width wraps it. What is left shows what is code: \P ends a line, and a code with a value, such as \C1;, runs to its semicolon.
C++
DxfIO::Document alone = DxfIO::Create(DxfIO::Version::R2018);DxfIO::Edit::Add(alone, note);const auto older = DxfIO::Save(alone, {.Release = DxfIO::Version::R12}) .and_then([](const DxfIO::Saved &flat) { return DxfIO::Load(flat.Bytes); });if (older){ for (const DxfIO::Entity &one : older->Document.Entities) { if (const auto *line = std::get_if<DxfIO::Entities::Text>(&one)) { std::println("{}", line->Lettering.Value); } }}
text
Pump P-1 feeds tank 3 through valve V-12, open in serviceDrain before winter