fix(io): map DXF text vertical alignment for correct rendering
TextEntity import was only mapping HorizontalAlignment to CadText, leaving VAlign at its default (Near/top). Middle-center text rendered shifted to the bottom instead of vertically centered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -839,6 +839,13 @@ namespace OpenNest.Forms
|
|||||||
ACadSharp.Entities.TextHorizontalAlignment.Right => System.Drawing.StringAlignment.Far,
|
ACadSharp.Entities.TextHorizontalAlignment.Right => System.Drawing.StringAlignment.Far,
|
||||||
_ => System.Drawing.StringAlignment.Near,
|
_ => System.Drawing.StringAlignment.Near,
|
||||||
};
|
};
|
||||||
|
var va = text.VerticalAlignment switch
|
||||||
|
{
|
||||||
|
ACadSharp.Entities.TextVerticalAlignmentType.Middle => System.Drawing.StringAlignment.Center,
|
||||||
|
ACadSharp.Entities.TextVerticalAlignmentType.Top => System.Drawing.StringAlignment.Near,
|
||||||
|
ACadSharp.Entities.TextVerticalAlignmentType.Bottom => System.Drawing.StringAlignment.Far,
|
||||||
|
_ => System.Drawing.StringAlignment.Far,
|
||||||
|
};
|
||||||
texts.Add(new CadText
|
texts.Add(new CadText
|
||||||
{
|
{
|
||||||
Position = new Vector(pt.X, pt.Y),
|
Position = new Vector(pt.X, pt.Y),
|
||||||
@@ -847,6 +854,7 @@ namespace OpenNest.Forms
|
|||||||
Rotation = text.Rotation,
|
Rotation = text.Rotation,
|
||||||
LayerName = text.Layer?.Name,
|
LayerName = text.Layer?.Name,
|
||||||
HAlign = ha,
|
HAlign = ha,
|
||||||
|
VAlign = va,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user