Class Font
Contents
[
Hide
]Font class
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
public sealed class Font
Constructors
Name | Description |
---|---|
Font(Font, FontStyle) | Initializes a new Font that uses the specified existing Font and FontStyle enumeration. |
Font(string, float) | Initializes a new Font using a specified size. The character set is set to Default, the graphics unit to Point, the font style to Regular. |
Font(string, float, FontStyle) | Initializes a new Font using a specified size and style. The character set is set to Default, the graphics unit to Point. |
Font(string, float, GraphicsUnit) | Initializes a new Font using a specified size and unit. The character set is set to Default, the style is set to Regular. |
Font(string, float, FontStyle, GraphicsUnit) | Initializes a new Font using a specified size, style, and unit. |
Font(string, float, FontStyle, GraphicsUnit, CharacterSet) | Initializes a new Font using a specified size, style, unit, and character set. |
Properties
Name | Description |
---|---|
Bold { get; } | Gets a value indicating whether this Font is bold. |
CharacterSet { get; } | Gets a byte value that specifies the character set that this Font uses. |
Italic { get; } | Gets a value indicating whether this Font is italic. |
Name { get; } | Gets the face name of this Font . |
Size { get; } | Gets the em-size of this Font measured in the units specified by the Unit property. |
Strikeout { get; } | Gets a value indicating whether this Font specifies a horizontal line through the font. |
Style { get; } | Gets style information for this Font . |
Underline { get; } | Gets a value indicating whether this Font is underlined. |
Unit { get; } | Gets the unit of measure for this Font . |
Methods
Name | Description |
---|---|
DeepClone() | Creates an exact deep copy of this Font . |
override Equals(object) | Indicates whether the specified object is a Font and has the same property values as this Font . |
override GetHashCode() | Gets the hash code for this Font . |
override ToString() | Returns a human-readable string representation of this Font . |
Examples
This example demonstrates the use of Font and SolidBrush class to draw strings on Image surface. The example creates a new Image and draw shapes using Figures and GraphicsPath
[C#]
//Creates an instance of Image
using (Aspose.PSD.Image image = new Aspose.PSD.FileFormats.Psd.PsdImage(500, 500))
{
//Creates and initialize an instance of Graphics class
Aspose.PSD.Graphics graphics = new Aspose.PSD.Graphics(image);
//Clears Graphics surface
graphics.Clear(Color.Wheat);
//Creates an instance of Font
Aspose.PSD.Font font = new Aspose.PSD.Font("Times New Roman", 16);
//Create an instance of SolidBrush having Red Color
Aspose.PSD.Brushes.SolidBrush brush = new Aspose.PSD.Brushes.SolidBrush(Color.Red);
//Draw a String
graphics.DrawString("Created by Aspose.PSD for .Net", font, brush, new PointF(100, 100));
// create export options.
Aspose.PSD.ImageOptions.GifOptions options = new Aspose.PSD.ImageOptions.GifOptions();
// save all changes
image.Save("C:\\temp\\output.gif", options);
}
See Also
- namespace Aspose.PSD
- assembly Aspose.PSD