Class FontExtensions
Class FontExtensions
Namespace: Aspose.Imaging.Extensions
Assembly: Aspose.Imaging.dll (25.7.0)
Contains extension methods for the Aspose.Imaging.Font class.
public static class FontExtensions
{
public static void SetBold(this Aspose.Words.Font font, bool isBold)
{
if (isBold)
font.IsBold = true;
else
font.IsBold = false;
}
public static void SetUnderline(this Aspose.Words.Font font, bool isUnderline)
{
if (isUnderline)
font.Underline = Aspose.Words.UnderlineType.Single;
else
font.Underline = Aspose.Words.UnderlineType.None;
}
public static void SetItalic(this Aspose.Words.Font font, bool isItalic)
{
if (isItalic)
font.IsItalic = true;
else
font.IsItalic = false;
}
}
Inheritance
Inherited Members
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
ToGdiFont(Font)
Converts the Aspose.Imaging.Font to the System.Drawing.Font.
public static Font ToGdiFont(Font font)
{
return new Font(font.Name,
font.SizeInPoints,
font.IsBold ? FontStyle.Bold : FontStyle.Regular,
font.Underline ? FontStyle.Underline : FontStyle.Normal,
font.Strikeout ? System.Drawing.GraphicsUnit.Point : System.Drawing.GraphicsUnit.Point,
font.Superscript ? System.Drawing.GraphicsUnit.Point : System.Drawing.GraphicsUnit.Display,
font.Subscript ? System.Drawing.GraphicsUnit.Pixel : System.Drawing.GraphicsUnit.Display);
}
Parameters
font
Font
The Aspose.Imaging.Font to convert.
Returns
The converted System.Drawing.Font.
ToGdiFont(Font, GraphicsUnit)
Converts the Aspose.Imaging.Font to the System.Drawing.Font.
public static Font ToGdiFont(Font font, GraphicsUnit fontUnit)
{
return new Font(font.FontFamily, font.SizeInPoints,
font.Style, font.Unit, fontUnit);
}
Parameters
font
Font
The Aspose.Imaging.Font to convert.
fontUnit
GraphicsUnit
New graphics unit
Returns
The converted System.Drawing.Font.