Class Font
Encapsulates the font properties of texts.
Inheritance
Namespace: Neodynamic.SDK.Printing
Assembly: cs.temp.dll.dll
Syntax
public class Font : INotifyPropertyChanged
Constructors
Font()
Initializes a new instance of the Font class.
Declaration
public Font()
Font(String, Single)
Initializes a new instance of the Font class with the specified font name and size.
Declaration
public Font(string name, float size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the font. |
System.Single | size | The size of the font measured in Points. |
Font(String, Single, FontUnit)
Initializes a new instance of the Font class with the specified font name, size and unit of measure.
Declaration
public Font(string name, float size, FontUnit unit)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the font. |
System.Single | size | The size of the font. |
FontUnit | unit | The unit of measure for the font. |
Font(String, String, Double, FontUnit)
Initializes a new instance of the Font class with the specified custom font file, size and unit of measure.
Declaration
public Font(string customFontFile, string customFontFileFamilyIndex, double size, FontUnit unit)
Parameters
Type | Name | Description |
---|---|---|
System.String | customFontFile | The custom font file to use. It's the full path pointing out to the custom font file on local disk. |
System.String | customFontFileFamilyIndex | |
System.Double | size | The size of the font measured in Points. |
FontUnit | unit | The unit of measure for the font. |
Font(String, String, Single)
Initializes a new instance of the Font class with the specified custom font file and size.
Declaration
public Font(string customFontFile, string customFontFileFamilyIndex, float size)
Parameters
Type | Name | Description |
---|---|---|
System.String | customFontFile | The custom font file to use. It's the full path pointing out to the custom font file on local disk. |
System.String | customFontFileFamilyIndex | |
System.Single | size | The size of the font measured in Points. |
Fields
NativePrinterFontA
The font name for the Native Printer Font A
Declaration
public const string NativePrinterFontA = "NativePrinterFontA"
Field Value
Type | Description |
---|---|
System.String |
NativePrinterFontB
The font name for the Native Printer Font B
Declaration
public const string NativePrinterFontB = "NativePrinterFontB"
Field Value
Type | Description |
---|---|
System.String |
NativePrinterFontS
The font name for the Native Printer Font S
Declaration
public const string NativePrinterFontS = "NativePrinterFontS"
Field Value
Type | Description |
---|---|
System.String |
Properties
Bold
Gets or sets a value that indicates whether this Font object is bold. Default value is false
Declaration
public bool Bold { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CodePage
Gets or sets the Code Page to be used with this font. Default value is CP850
Declaration
public CodePage CodePage { get; set; }
Property Value
Type | Description |
---|---|
CodePage |
CustomFontFile
Gets or sets the custom font file to use for this Font object. It's the full path pointing out to the custom font file on local disk; or the font file content in Base64 format. Default value is an empty string
Declaration
public string CustomFontFile { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CustomFontFileFamilyName
Gets or sets the Font Family name of the type faces defined by the specified Custom Font File. Default value is an empty string
Declaration
public string CustomFontFileFamilyName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsBitmapFont
Gets or sets whether the specified font is a Bitmap Font a.k.a. Pixel Font. Default value is false
Declaration
public bool IsBitmapFont { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNativePrinterFont
Gets whether this font is a Native Printer Font.
Declaration
public bool IsNativePrinterFont { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Italic
Gets or sets a value that indicates whether this Font object is italic. Default value is false
Declaration
public bool Italic { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets or sets the face name of this Font object. Default value is NativePrinterFontA
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
NameAtPrinterStorage
Gets or sets the name of this Font object available in the Printer's internal storage including the drive location and name, for example B:ARIAL. IMPORTANT: The name must be 1 to 8 alphanumeric characters long.
Declaration
public string NameAtPrinterStorage { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Size
Gets or sets the size of this Font object. Default value is 10
Declaration
public double Size { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | The specified value is not greater than zero. |
Strikeout
Gets or sets a value that indicates whether this Font object specifies a horizontal line through the font. Default value is false
Declaration
public bool Strikeout { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Threshold
Gets or sets the threshold percentage used for converting the font glyphs to black and white graphics. Values range from 0 to 100. Default value is 90.
Declaration
public int Threshold { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Underline
Gets or sets a value that indicates whether this Font object is underlined. Default value is false
Declaration
public bool Underline { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Unit
Gets or sets the unit of measure for this Font object. Default value is Point
Declaration
public FontUnit Unit { get; set; }
Property Value
Type | Description |
---|---|
FontUnit |
Methods
GetNearestSizeForNativePrinterFonts(Font)
Gets the nearest fixed size for the specified Font object. The Font object should be one of the supported Native Printer Fonts.
Declaration
public static double GetNearestSizeForNativePrinterFonts(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The Font object on which the nearest fixed size is calculated. |
Returns
Type | Description |
---|---|
System.Double | The nearest fixed size for the specified Font object. |
Remarks
Native Printer Fonts accept the following fixed sizes:
- NativePrinterFontS: 3pt (this font does support just this value only)
- NativePrinterFontA: 5pt, 10pt, 15pt, 20pt, and 25pt
- NativePrinterFontB: 7pt, 14pt, 21pt, 28pt, and 35pt
By using this method, you can get the nearest fixed size if the specified Font object has a different value for the font size.
OnPropertyChanged(String)
Declaration
protected void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
ToString()
Converts the Font object to a string representation, using the current System.Globalization.CultureInfo.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The string representation of the Font object in the current culture. |
ToString(CultureInfo)
Converts the Font object to a string representation, using the specified System.Globalization.CultureInfo.
Declaration
public string ToString(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | A System.Globalization.CultureInfo that contains the culture to represent the Font. |
Returns
Type | Description |
---|---|
System.String | The string representation of the Font object in the specified culture. |
UpdateFrom(Font)
Declaration
public void UpdateFrom(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font |
Events
PropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |