Class TextStyle
Represents a text style.
Implements
Inherited Members
Namespace: netDxf.Tables
Assembly: CADability.dll
Syntax
public class TextStyle : TableObject, IHasXData, ICloneable, IComparable, IComparable<TableObject>, IEquatable<TableObject>
Constructors
| Improve this Doc View SourceTextStyle(String)
Initializes a new instance of the TextStyle class.
Declaration
public TextStyle(string font)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | font | Text style font file name with full or relative path. |
Remarks
The font file name, without the extension, will also be used as the name of the text style.
TextStyle(String, FontStyle)
Initializes a new instance of the TextStyle class exclusively to be used with true type fonts.
Declaration
public TextStyle(string fontFamily, FontStyle fontStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontFamily | True type font family name. |
| FontStyle | fontStyle | True type font style |
Remarks
This constructor is to be use only with true type fonts. The fontFamily value will also be used as the name of the text style.
TextStyle(String, String)
Initializes a new instance of the TextStyle class.
Declaration
public TextStyle(string name, string font)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Text style name. |
| System.String | font | Text style font file name with full or relative path. |
TextStyle(String, String, FontStyle)
Initializes a new instance of the TextStyle class exclusively to be used with true type fonts.
Declaration
public TextStyle(string name, string fontFamily, FontStyle fontStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Text style name. |
| System.String | fontFamily | True type font family name. |
| FontStyle | fontStyle | True type font style |
Remarks
This constructor is to be use only with true type fonts.
Fields
| Improve this Doc View SourceDefaultName
Default text style name.
Declaration
public const string DefaultName = "Standard"
Field Value
| Type | Description |
|---|---|
| System.String |
Properties
| Improve this Doc View SourceBigFont
Gets or sets an Asian-language Big Font file.
Declaration
public string BigFont { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
Only ACAD compiled shape SHX fonts are valid for creating Big Fonts.
Default
Gets the default text style.
Declaration
public static TextStyle Default { get; }
Property Value
| Type | Description |
|---|---|
| TextStyle |
FontFamilyName
Gets or sets the true type font family name.
Declaration
public string FontFamilyName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
When the font family name is manually specified the file font will not be used and it will be set to empty,
the font style will also we set to FontStyle.Regular.
In this case the font information will be stored in the style extended data when saved to a DXF.
This value is only applicable for true type fonts.
FontFile
Gets or sets the text style font file name.
Declaration
public string FontFile { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
When this value is used for true type fonts should be present in the Font system folder.
When the style does not contain any information for the file the font information will be saved in the extended data when saved to a DXF,
this is only applicable for true type fonts.
FontStyle
Gets or sets the true type font style.
Declaration
public FontStyle FontStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| FontStyle |
Remarks
The font style value is ignored and will always return FontStyle.Regular when a font file has been specified.
All styles might or might not be available for the current font family.
Height
Gets or sets the text height.
Declaration
public double Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Fixed text height; 0 if not fixed.
IsBackward
Gets or sets if the text is backward (mirrored in X).
Declaration
public bool IsBackward { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsUpsideDown
Gets or sets if the text is upside down (mirrored in Y).
Declaration
public bool IsUpsideDown { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsVertical
Gets or sets the text is vertical.
Declaration
public bool IsVertical { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ObliqueAngle
Gets or sets the font oblique angle in degrees.
Declaration
public double ObliqueAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values range from -85 to 85. Default: 0.0.
Owner
Gets the owner of the actual text style.
Declaration
public TextStyles Owner { get; }
Property Value
| Type | Description |
|---|---|
| TextStyles |
WidthFactor
Gets or sets the text width factor.
Declaration
public double WidthFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values range from 0.01 to 100. Default: 1.0.
Methods
| Improve this Doc View SourceClone()
Creates a new TextStyle that is a copy of the current instance.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new TextStyle that is a copy of this instance. |
Overrides
| Improve this Doc View SourceClone(String)
Creates a new TextStyle that is a copy of the current instance.
Declaration
public override TableObject Clone(string newName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | newName | TextStyle name of the copy. |
Returns
| Type | Description |
|---|---|
| TableObject | A new TextStyle that is a copy of this instance. |
Overrides
| Improve this Doc View SourceTrueTypeFontFamilyName(String)
Find the font family name of an specified TTF font file.
Declaration
public static string TrueTypeFontFamilyName(string ttfFont)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | ttfFont | TTF font file. |
Returns
| Type | Description |
|---|---|
| System.String | The font family name of the specified TTF font file. |
Remarks
This method will return an empty string if the specified font is not found in its path or the system font folder or if it is not a valid TTF font.