protected internal override void UpdateSize() { if (ValidRect) { return; } RotatedRectangleF textRect; if (!TextPath.IsEmpty) { var dpi = Canvas != null ? 96 * Canvas.Zoom : 72; textRect = new RotatedRectangleF(MeasureText(dpi)); textRect.Scale(72 / dpi, 72 / dpi); var firstPoint = TextPath.GetFirstPoint(); // Move text rectangle to the text path's first point because GetBlackBox returns an empty rectangle (in location 0:0) when text is empty if (textRect.IsEmpty) { textRect.CenterX = firstPoint.X; textRect.CenterY = firstPoint.Y; } textRect.RotateAt(Angle, firstPoint); } else { textRect = new RotatedRectangleF(); } Path = Path.CreateRectanglePath(textRect.ToRectangleF()); Transform.Clear(keepAngle: true); ActualAngle = Transform.Angle; ValidRect = true; }
private Math.PointF GetDrawingFirstPoint(float dpi = 72) { return(Utils.EqualsOfFloatNumbers(72, dpi) ? new Math.PointF(TextPath.GetFirstPoint()) : new Math.PointF(TextPath.GetFirstPoint()).Scale(dpi / 72, dpi / 72)); }