本文整理汇总了C#中System.Drawing.Font.GetDescentHeight方法的典型用法代码示例。如果您正苦于以下问题:C# Font.GetDescentHeight方法的具体用法?C# Font.GetDescentHeight怎么用?C# Font.GetDescentHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Font
的用法示例。
在下文中一共展示了Font.GetDescentHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BitmapFont
/// <summary>
/// Initializes a new instance of the <see cref="BitmapFont" /> class.
/// </summary>
/// <param name="fontName">The font name.</param>
/// <param name="fontSize">The font size.</param>
/// <param name="fontStyle">The font style.</param>
/// <param name="characters">The included characters.</param>
public BitmapFont(string fontName, float fontSize, FontStyle fontStyle, string characters)
{
if (fontName == null)
{
throw new ArgumentNullException(nameof(fontName));
}
if (characters == null)
{
throw new ArgumentNullException(nameof(characters));
}
if (characters.Length == 0)
{
throw new ArgumentException("Font must include at least one character.", nameof(characters));
}
Array.Sort(this.characters = characters.ToCharArray());
this.glyphs = new BitmapGlyph[this.characters.Length];
this.whitespace = new BitmapGlyph(this.Texture, null, null) { Width = 0, Height = 0, MinU = 0, MinV = 0, MaxU = 0, MaxV = 0 };
var font = new Font(fontName, fontSize, fontStyle);
var lineHeight = font.GetHeight();
var descent = font.GetDescentHeight();
var baseline = descent * DescentFactor;
var ascent = (lineHeight - baseline) * AscentFactor;
this.LineHeight = lineHeight;
this.Ascent = ascent;
this.Descent = descent;
this.Baseline = baseline;
this.Ready = this.Load(font); // <- Load will dispose of the font.
}