Method TextStyleWithFont
- Namespace
- BitMiracle.Docotic.Pdf.Layout
- Assembly
- BitMiracle.Docotic.Pdf.Layout.dll
TextStyleWithFont(SystemFont, FontEmbedMode?)
Creates a text style based on a font from the system font collection.
public TextStyle TextStyleWithFont(SystemFont font, FontEmbedMode? embedMode = null)
Parameters
font
SystemFontThe description of the font.
embedMode
FontEmbedMode?The preferred font embed mode. Can be
null
.
Returns
- TextStyle
The text style associated with the font.
Remarks
When embedMode
is null
the library embeds used glyphs for
TrueType/OpenType fonts, does not embed built-in PDF fonts, and embeds all glyphs for
Type1 and CFF fonts.
Read the Fonts and colors section of the C# PDF generation quick start guide for examples of using text styles.
Exceptions
- ArgumentNullException
font
isnull
.- UnsupportedFontException
Unable to load font. Make sure that the font is installed in the system font collection or can be loaded using the current IFontLoader.
TextStyleWithFont(FileInfo, FontEmbedMode?)
Creates a text style based on a font from file.
public TextStyle TextStyleWithFont(FileInfo file, FontEmbedMode? embedMode = null)
Parameters
file
FileInfoThe font file.
embedMode
FontEmbedMode?The preferred font embed mode. Can be
null
.
Returns
- TextStyle
The text style associated with the font.
Remarks
When embedMode
is null
the library embeds used glyphs for
TrueType/OpenType fonts, does not embed built-in PDF fonts, and embeds all glyphs for
Type1 and CFF fonts.
Read the Fonts and colors section of the C# PDF generation quick start guide for examples of using text styles.
Exceptions
- ArgumentNullException
file
isnull
.
TextStyleWithFont(Stream, FontEmbedMode?)
Creates a text style based on a font from stream.
public TextStyle TextStyleWithFont(Stream stream, FontEmbedMode? embedMode = null)
Parameters
stream
StreamThe font stream.
embedMode
FontEmbedMode?The preferred font embed mode. Can be
null
.
Returns
- TextStyle
The text style associated with the font.
Remarks
Caller of the method is responsible for disposing of the stream.
When embedMode
is null
the library embeds used glyphs for
TrueType/OpenType fonts, does not embed built-in PDF fonts, and embeds all glyphs for
Type1 and CFF fonts.
Read the Fonts and colors section of the C# PDF generation quick start guide for examples of using text styles.
Exceptions
- ArgumentNullException
stream
isnull
.