iron-software / IronSoftware.System.Drawing

An open-source System.Drawing.Common replacement for .NET 5 and above on all platforms. Bringing together System.Drawing, Maui, and ImageSharp's Bitmap, Image, Font, and Shape types via an agnostic free NuGet package.
Other
114 stars 18 forks source link

Implement casting between IronPdf.Font.FontTypes and Font #68

Closed mee-ironsoftware closed 1 year ago

mee-ironsoftware commented 1 year ago

Description

  1. Move IronPdf.Font.FontTypes into IronDrawing
  2. Implement casting between FontTypes and Font

Casting FontTypes to Font

IronSoftware.Drawing.Font font = IronPdf.Font.FontTypes.TimesNewRomanBoldItalic;

Casting FontTypes from Font

var font = new IronSoftware.Drawing.Font("Courier New", FontStyle.Bold);
IronPdf.Font.FontTypes fontTypes = font;

Fixes IRON-1284

Type of change

Please select the relevant option by placing an 'x' inside the brackets, like this: [x].

How Has This Been Tested?

Add 3 unit tests

  1. Casting FontTypes to Font
  2. Casting Font to FontTypes
  3. Casting Font to FontTypes should throw exception if font not supported in FontTypes

Checklist:

Please run through the checklist as much as possible and mark the items completed by placing an 'x' inside the brackets, like this: [x].