Class TextFormat
- Namespace
- SharpDX.DirectWrite
- Assembly
- SharpDX.Direct2D1.dll
[Guid("9c906818-31d7-4fd3-a151-7c5e225db55a")]
public class TextFormat : ComObject
- Inheritance
-
TextFormat
- Derived
Constructors
TextFormat(Factory, string, FontCollection, FontWeight, FontStyle, FontStretch, float)
Creates a text format object used for text layout.
public TextFormat(Factory factory, string fontFamilyName, FontCollection fontCollection, FontWeight fontWeight, FontStyle fontStyle, FontStretch fontStretch, float fontSize)
Parameters
factory
Factoryan instance of Factory
fontFamilyName
stringAn array of characters that contains the name of the font family
fontCollection
FontCollectionA pointer to a font collection object. When this is NULL, indicates the system font collection.
fontWeight
FontWeightA value that indicates the font weight for the text object created by this method.
fontStyle
FontStyleA value that indicates the font style for the text object created by this method.
fontStretch
FontStretchA value that indicates the font stretch for the text object created by this method.
fontSize
floatThe logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch.
TextFormat(Factory, string, FontCollection, FontWeight, FontStyle, FontStretch, float, string)
Creates a text format object used for text layout.
public TextFormat(Factory factory, string fontFamilyName, FontCollection fontCollection, FontWeight fontWeight, FontStyle fontStyle, FontStretch fontStretch, float fontSize, string localeName)
Parameters
factory
Factoryan instance of Factory
fontFamilyName
stringAn array of characters that contains the name of the font family
fontCollection
FontCollectionA pointer to a font collection object. When this is NULL, indicates the system font collection.
fontWeight
FontWeightA value that indicates the font weight for the text object created by this method.
fontStyle
FontStyleA value that indicates the font style for the text object created by this method.
fontStretch
FontStretchA value that indicates the font stretch for the text object created by this method.
fontSize
floatThe logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch.
localeName
stringAn array of characters that contains the locale name.
TextFormat(Factory, string, FontWeight, FontStyle, FontStretch, float)
Creates a text format object used for text layout.
public TextFormat(Factory factory, string fontFamilyName, FontWeight fontWeight, FontStyle fontStyle, FontStretch fontStretch, float fontSize)
Parameters
factory
Factoryan instance of Factory
fontFamilyName
stringAn array of characters that contains the name of the font family
fontWeight
FontWeightA value that indicates the font weight for the text object created by this method.
fontStyle
FontStyleA value that indicates the font style for the text object created by this method.
fontStretch
FontStretchA value that indicates the font stretch for the text object created by this method.
fontSize
floatThe logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch.
TextFormat(Factory, string, FontWeight, FontStyle, float)
Creates a text format object used for text layout with normal stretch.
public TextFormat(Factory factory, string fontFamilyName, FontWeight fontWeight, FontStyle fontStyle, float fontSize)
Parameters
factory
Factoryan instance of Factory
fontFamilyName
stringAn array of characters that contains the name of the font family
fontWeight
FontWeightA value that indicates the font weight for the text object created by this method.
fontStyle
FontStyleA value that indicates the font style for the text object created by this method.
fontSize
floatThe logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch.
TextFormat(Factory, string, float)
Creates a text format object used for text layout with normal weight, style and stretch.
public TextFormat(Factory factory, string fontFamilyName, float fontSize)
Parameters
factory
Factoryan instance of Factory
fontFamilyName
stringAn array of characters that contains the name of the font family
fontSize
floatThe logical size of the font in DIP ("device-independent pixel") units. A DIP equals 1/96 inch.
TextFormat(nint)
public TextFormat(nint nativePtr)
Parameters
nativePtr
nint
Properties
FlowDirection
Gets or sets the direction that text lines flow.
public FlowDirection FlowDirection { get; set; }
Property Value
FontCollection
Gets the current font collection.
public FontCollection FontCollection { get; }
Property Value
FontFamilyName
Gets a copy of the font family name.
public string FontFamilyName { get; }
Property Value
- string
the current font family name.
FontSize
Gets the font size in DIP unites.
public float FontSize { get; }
Property Value
FontStretch
Gets the font stretch of the text.
public FontStretch FontStretch { get; }
Property Value
FontStyle
Gets the font style of the text.
public FontStyle FontStyle { get; }
Property Value
FontWeight
Gets the font weight of the text.
public FontWeight FontWeight { get; }
Property Value
IncrementalTabStop
Gets or sets the incremental tab stop position.
public float IncrementalTabStop { get; set; }
Property Value
LocaleName
Gets a copy of the locale name.
public string LocaleName { get; }
Property Value
- string
the current locale name.
ParagraphAlignment
Gets or sets the alignment option of a paragraph which is relative to the top and bottom edges of a layout box.
public ParagraphAlignment ParagraphAlignment { get; set; }
Property Value
ReadingDirection
Gets or sets the current reading direction for text in a paragraph.
public ReadingDirection ReadingDirection { get; set; }
Property Value
TextAlignment
Gets or sets the alignment option of text relative to the layout box's leading and trailing edge.
public TextAlignment TextAlignment { get; set; }
Property Value
WordWrapping
Gets or sets the word wrapping option.
public WordWrapping WordWrapping { get; set; }
Property Value
Methods
GetLineSpacing(out LineSpacingMethod, out float, out float)
Gets the line spacing adjustment set for a multiline text paragraph.
public void GetLineSpacing(out LineSpacingMethod lineSpacingMethod, out float lineSpacing, out float baseline)
Parameters
lineSpacingMethod
LineSpacingMethodA value that indicates how line height is determined.
lineSpacing
floatWhen this method returns, contains the line height, or distance between one baseline to another.
baseline
floatWhen this method returns, contains the distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent.
GetTrimming(out Trimming, out InlineObject)
Gets the trimming options for text that overflows the layout box.
public void GetTrimming(out Trimming trimmingOptions, out InlineObject trimmingSign)
Parameters
trimmingOptions
TrimmingWhen this method returns, it contains a reference to a Trimming structure that holds the text trimming options for the overflowing text.
trimmingSign
InlineObjectWhen this method returns, contains an address of a reference to a trimming omission sign. This parameter may be
null
.
SetLineSpacing(LineSpacingMethod, float, float)
Sets the line spacing.
public void SetLineSpacing(LineSpacingMethod lineSpacingMethod, float lineSpacing, float baseline)
Parameters
lineSpacingMethod
LineSpacingMethodSpecifies how line height is being determined; see LineSpacingMethod for more information.
lineSpacing
floatThe line height, or distance between one baseline to another.
baseline
floatThe distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent.
Remarks
For the default method, spacing depends solely on the content. For uniform spacing, the specified line height overrides the content.
SetTrimming(Trimming, InlineObject)
Sets trimming options for text overflowing the layout width.
public void SetTrimming(Trimming trimmingOptions, InlineObject trimmingSign)
Parameters
trimmingOptions
TrimmingText trimming options.
trimmingSign
InlineObjectApplication-defined omission sign. This parameter may be
null
. See InlineObject for more information.
Operators
explicit operator TextFormat(nint)
public static explicit operator TextFormat(nint nativePtr)
Parameters
nativePtr
nint