Opened 5 years ago

Closed 5 years ago

#7047 closed defect (fixed)

DXF: Incorrect text escaping behaviour

Reported by: Alan Thomas Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: dxf
Cc:

Description (last modified by Alan Thomas)

The behaviour of AutoCAD is to apply %%d, %%c and %%p escapes in the text content of TEXT, MTEXT and DIMENSION objects only. Additionally, backslash escapes like \P and \~ only work on MTEXT objects. Layer names and the like do not honor any escapes.

See the attached DXF file, screenshot and patch. ogrinfo currently issues the following output for this DXF file:

OGRFeature(Entities):0
  OGR_GEOMETRY (String) = POINT
  Layer (String) = MyLayer°∅
  SubClasses (String) = AcDbEntity:AcDbText:AcDbText
  EntityHandle (String) = EEEF0
  Text (String) = singleline%%D∅\\P\Pmore\~text
  Style = LABEL(f:"YourTextStyle°∅",t:"singleline%%D∅\\P\Pmore\~text",p:1,s:1g,c:#000000)
  POINT Z (0 0 0)

OGRFeature(Entities):1
  OGR_GEOMETRY (String) = POINT
  Layer (String) = MyLayer°∅
  SubClasses (String) = AcDbEntity:AcDbMText
  EntityHandle (String) = EEEEF
  Text (String) = multiline°∅\P
more text
  Style = LABEL(f:"Arial",t:"multiline°∅\P
more text",s:1g,p:7,c:#000000)
  POINT Z (0 5 0)

The layer name, text style name, and text contents of the TEXT object are incorrect.

Attachments (3)

TextEscapingReduced.dxf (5.4 KB ) - added by Alan Thomas 5 years ago.
text-escapes.png (46.7 KB ) - added by Alan Thomas 5 years ago.
OGR-DXF-text-escapes.diff (9.3 KB ) - added by Alan Thomas 5 years ago.
Fixed patch

Download all attachments as: .zip

Change History (6)

by Alan Thomas, 5 years ago

Attachment: TextEscapingReduced.dxf added

by Alan Thomas, 5 years ago

Attachment: text-escapes.png added

comment:1 by Alan Thomas, 5 years ago

Description: modified (diff)

comment:2 by Alan Thomas, 5 years ago

I think that patch is buggy. Let me see if I can fix it...

by Alan Thomas, 5 years ago

Attachment: OGR-DXF-text-escapes.diff added

Fixed patch

comment:3 by Even Rouault, 5 years ago

Resolution: fixed
Status: newclosed

In 40149:

DXF: only apply certain escaping rules to the text of the MTEXT object (patch by atlight, fixes #7047); fix related compilation errors in the Teigha DWG drivers (by myself), but correctness unverified

Note: See TracTickets for help on using tickets.