VectSharp 2.6.1
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.Font Class Reference

Represents a typeface with a specific size. More...

Classes

class  DetailedFontMetrics
 Represents detailed information about the metrics of a text string when drawn with a certain font. More...
 
class  FontUnderline
 Represents options to underline text. More...
 

Public Member Functions

 Font (FontFamily fontFamily, double fontSize)
 Create a new Font object, given the base typeface and the font size. More...
 
 Font (FontFamily fontFamily, double fontSize, bool underlined)
 Create a new Font object, given the base typeface, the font size, and a boolean value determining whether text using this font should be underlined. More...
 
 Font (FontFamily fontFamily, double fontSize, FontUnderline underline)
 Create a new Font object, given the base typeface, the font size, and an object describing the underline properties of text drawn using this font. More...
 
Size MeasureText (string text)
 Measure the size of a text string when typeset with this font. More...
 
DetailedFontMetrics MeasureTextAdvanced (string text)
 Measure all the metrics of a text string when typeset with this font. More...
 

Static Public Attributes

static bool EnableKerning = true
 Determines whether text kerning is enabled. Note that, even when this is set to false, text kerning will be applied on some platforms. For the best consistency, leave this set to true. More...
 

Properties

double FontSize [get]
 Font size, in graphics units. More...
 
FontFamily FontFamily [get]
 Font typeface. More...
 
double Ascent [get]
 Maximum height over the baseline of the usual glyphs in the font (there may be glyphs taller than this). Always >= 0. More...
 
double WinAscent [get]
 Height above the baseline for a clipping region (Windows ascent). Always >= 0. More...
 
double Descent [get]
 Maximum depth below the baseline of the usual glyphs in the font (there may be glyphs deeper than this). Always <= 0. More...
 
double YMax [get]
 Absolute maximum height over the baseline of the glyphs in the font. Always >= 0. More...
 
double YMin [get]
 Absolute maximum depth below the baseline of the glyphs in the font. Always <= 0. More...
 
FontUnderline Underline [get]
 Determines the underline style of text drawn using this font. If this is null, the text is not underlined. More...
 

Detailed Description

Represents a typeface with a specific size.

Definition at line 29 of file Font.cs.

Constructor & Destructor Documentation

◆ Font() [1/3]

VectSharp.Font.Font ( FontFamily  fontFamily,
double  fontSize 
)

Create a new Font object, given the base typeface and the font size.

Parameters
fontFamilyBase typeface. See FontFamily.
fontSizeThe font size, in graphics units.

Definition at line 166 of file Font.cs.

◆ Font() [2/3]

VectSharp.Font.Font ( FontFamily  fontFamily,
double  fontSize,
bool  underlined 
)

Create a new Font object, given the base typeface, the font size, and a boolean value determining whether text using this font should be underlined.

Parameters
fontFamilyBase typeface. See FontFamily.
fontSizeThe font size, in graphics units.
underlinedA boolean value determining whether text drawn using this font should be underlined. The appearance of the underline can be tweaked by changing the properties of the Underline property after the font has been created.

Definition at line 178 of file Font.cs.

◆ Font() [3/3]

VectSharp.Font.Font ( FontFamily  fontFamily,
double  fontSize,
FontUnderline  underline 
)

Create a new Font object, given the base typeface, the font size, and an object describing the underline properties of text drawn using this font.

Parameters
fontFamilyBase typeface. See FontFamily.
fontSizeThe font size, in graphics units.
underlineA FontUnderline object describing the underline properties of text drawn using this font.

Definition at line 195 of file Font.cs.

Member Function Documentation

◆ MeasureText()

Size VectSharp.Font.MeasureText ( string  text)

Measure the size of a text string when typeset with this font.

Parameters
textThe string to measure.
Returns
A Size object representing the width and height of the text.

Definition at line 302 of file Font.cs.

◆ MeasureTextAdvanced()

DetailedFontMetrics VectSharp.Font.MeasureTextAdvanced ( string  text)

Measure all the metrics of a text string when typeset with this font.

Parameters
textThe string to measure.
Returns
A DetailedFontMetrics object representing the metrics of the text.

Definition at line 359 of file Font.cs.

Member Data Documentation

◆ EnableKerning

bool VectSharp.Font.EnableKerning = true
static

Determines whether text kerning is enabled. Note that, even when this is set to false, text kerning will be applied on some platforms. For the best consistency, leave this set to true.

Definition at line 34 of file Font.cs.

Property Documentation

◆ Ascent

double VectSharp.Font.Ascent
get

Maximum height over the baseline of the usual glyphs in the font (there may be glyphs taller than this). Always >= 0.

Definition at line 205 of file Font.cs.

◆ Descent

double VectSharp.Font.Descent
get

Maximum depth below the baseline of the usual glyphs in the font (there may be glyphs deeper than this). Always <= 0.

Definition at line 241 of file Font.cs.

◆ FontFamily

FontFamily VectSharp.Font.FontFamily
get

Font typeface.

Definition at line 159 of file Font.cs.

◆ FontSize

double VectSharp.Font.FontSize
get

Font size, in graphics units.

Definition at line 154 of file Font.cs.

◆ Underline

FontUnderline VectSharp.Font.Underline
get

Determines the underline style of text drawn using this font. If this is null, the text is not underlined.

Definition at line 295 of file Font.cs.

◆ WinAscent

double VectSharp.Font.WinAscent
get

Height above the baseline for a clipping region (Windows ascent). Always >= 0.

Definition at line 223 of file Font.cs.

◆ YMax

double VectSharp.Font.YMax
get

Absolute maximum height over the baseline of the glyphs in the font. Always >= 0.

Definition at line 259 of file Font.cs.

◆ YMin

double VectSharp.Font.YMin
get

Absolute maximum depth below the baseline of the glyphs in the font. Always <= 0.

Definition at line 277 of file Font.cs.


The documentation for this class was generated from the following file: