Closed J4MMYD0D93R closed 2 years ago
tl;dr - The behavior is correct according to the spec; verify that you're using the Location
property for the text's placement, and not the SecondAlignmentPoint
property.
My understanding of the spec for this case is that it's correct.
Code 72 is the property HorizontalTextJustification
which is defined as DxfHorizontalTextJustification
where a value of Left
= 0
, Center
= 1
, etc. The property SecondAlignmentPoint
corresponds to codes 11
/21
/31
and the note given in the spec states:
This value is meaningful only if the value of a 72 or 73 group is nonzero (if the justification is anything other than baseline/left)
Where "nonzero" means, "not Left
", so a 72
value of 0
(which means Left
) indicates that codes 11
/21
/31
should not be written.
Where you're getting the position defaulting back to the origin means you're likely interpreting the SecondAlignmentPoint
property as the text location, but the actual location is specified by codes 10
/20
/30
which corresponds to the Location
property.
I am using this Dxf library for a mobile app, and I am exporting some lines and points as a DxfFile. I am adding some text to one of the points using the DxfText class, but when I set the HorizontalTextJustification to DxfHorizontalTextJustification.Center, the text position is set to the origin point. Opening the file in notepad, I see the following:
With HorizontalTextJustification set to DxfHorizontalTextJustification.Center: Point 1 72 1 11 0.0 21 0.0 31 0.0 100
With HorizontalTextJustification not set at all: Point 1 100
With HorizontalTextJustification not set, the text renders in the correct location, but with the Alignment set to Left.