Skip to content

feat: decode TEXT and MTEXT entities and render annotations in SVG and 2D viewer - #75

Merged
mahach666 merged 4 commits into
mainfrom
feat/text-and-mtext
Dec 2, 2026
Merged

mahach666 merged 4 commits into
mainfrom
feat/text-and-mtext

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Summary

  • Extract shared RecordStringStream helper to read R2004 inline codepage strings and R2007+ separate UTF-16LE object string streams cleanly across LayerParser and EntityDecoder (also fixing R2007+ CMENC color name/book skipping in EntityDecoder).
  • Decode TEXT (0x01) and MTEXT (0x2C) entity bodies in EntityDecoder:
    • TEXT: DataFlags conditionally parsed fields (Elevation, InsertionPt, AlignmentPt, Oblique, Rotation, Height, WidthFactor, alignment flags, and text value), selecting AlignmentPt when aligned.
    • MTEXT: InsertionPt, XAxisDir (computing rotation angle), RectWidth, RectHeight (R2007+), TextHeight, Attachment, and multiline formatted string.
  • Add DwgEntityKind.Text, DwgEntityKind.MText, DwgEntity.Text, and DwgEntity.PlainText (stripping MTEXT formatting codes such as \P, \~, \S...;, \f...;, \C...;, {...}).
  • Render TEXT and MTEXT in:
    • DwgJsonExporter (text and plainText fields)
    • DwgSvgExporter (<text> / <tspan> elements with rotation and viewBox expansion)
    • DwgCadHtmlViewer (rotated/anchored multiline canvas text rendering, hit-testing, properties panel, and searchable text)
    • dwgio inspect / entities (DwgEntity.ToString())
  • Add TextEntitiesTests covering R2018 & R2004 TEXT and MTEXT, alignment handling, MTEXT escape stripping, JSON, SVG, and 2D HTML viewer exports.

Stacked on #74.

Verification

  • dotnet build DwgIO.slnx -c Release — 0 warnings, 0 errors
  • dotnet test DwgIO.slnx -c Release --no-build — 288 passed, 0 failed, 1 skipped (unconfigured private fixtures) on both net8.0 and net10.0
  • BuildNativeCoreOnly=true passed cleanly for both DwgIO.csproj and DwgIO.Scene.csproj

@mahach666
mahach666 changed the base branch from feat/layers-and-bylayer to main December 2, 2026 10:40
@mahach666
mahach666 merged commit 7f5ffef into main Dec 2, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant