当前位置: 首页>>代码示例>>C#>>正文


C# Font.GetDescentHeight方法代码示例

本文整理汇总了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.
        }
开发者ID:vetuomia,项目名称:rocket,代码行数:40,代码来源:BitmapFont.cs


注:本文中的System.Drawing.Font.GetDescentHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。