Skip to content

Commit 490615a

Browse files
committed
Remove format changes (again)
2 parents f291738 + 789e6f4 commit 490615a

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

Platforms/NGraphics.Net/SystemDrawingPlatform.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using System;
2-
using System.Drawing;
3-
using System.Drawing.Imaging;
4-
using System.Collections.Generic;
5-
using System.Drawing.Drawing2D;
1+
using System;
2+
using System.Drawing;
3+
using System.Drawing.Imaging;
4+
using System.Collections.Generic;
5+
using System.Drawing.Drawing2D;
66
using System.IO;
7-
using System.Threading.Tasks;
8-
9-
namespace NGraphics
7+
using System.Threading.Tasks;
8+
9+
namespace NGraphics
1010
{
1111
public class SystemDrawingPlatform : IPlatform
1212
{
@@ -160,22 +160,22 @@ public void RestoreState()
160160

161161
public Size MeasureText(string text, Font font)
162162
{
163-
using (var netFont = new System.Drawing.Font(font.Name, (float)font.Size, FontStyle.Regular, GraphicsUnit.Point))
164-
{
165-
var result = graphics.MeasureString(text, netFont);
166-
return new Size(result.Width, result.Height);
167-
}
168-
}
163+
using (var netFont = new System.Drawing.Font(font.Name, (float)font.Size, FontStyle.Regular, GraphicsUnit.Point))
164+
{
165+
var result = graphics.MeasureString(text, netFont);
166+
return new Size(result.Width, result.Height);
167+
}
168+
}
169169

170170
public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
171171
{
172-
if (brush == null) throw new ArgumentNullException(nameof(brush));
173-
172+
if (brush == null)
173+
return;
174174
var sdfont = new System.Drawing.Font(font.Family, (float)font.Size, FontStyle.Regular, GraphicsUnit.Point);
175175
var sz = graphics.MeasureString(text, sdfont);
176176
var point = frame.Position;
177-
var fr = new Rect(point, new Size(sz.Width, sz.Height));
178-
graphics.DrawString(text, sdfont, Conversions.GetBrush(brush, fr), Conversions.GetPointF(point));// - new Point(0, sdfont.Height)));
177+
var fr = new Rect(point, new Size(sz.Width, sz.Height));
178+
graphics.DrawString(text, sdfont, Conversions.GetBrush(brush, fr), Conversions.GetPointF(point - new Point(0, sdfont.Height)));
179179
}
180180
public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
181181
{
@@ -419,6 +419,5 @@ public static System.Drawing.Rectangle GetRectangle(this Rect frame)
419419
{
420420
return new System.Drawing.Rectangle((int)frame.X, (int)frame.Y, (int)frame.Width, (int)frame.Height);
421421
}
422-
}
423-
}
424-
422+
}
423+
}

0 commit comments

Comments
 (0)