/// <summary> /// 用一个纹理绘制指定范围内的可见字符 /// </summary> /// <param name="fontFilename">字体文件名</param> /// <param name="fontHeight">此值越大,绘制文字的清晰度越高,但占用的纹理资源就越多。</param> /// <param name="firstChar">要显示的第一个字符</param> /// <param name="lastChar">要显示的最后一个字符</param> public FontElement(string fontFilename, int fontHeight, char firstChar, char lastChar) { if (firstChar > lastChar) { throw new ArgumentException("first char should <= last char"); } int[] maxTextureWidth = new int[1]; // Get the maximum texture size supported by GL. GL.GetInteger(GetTarget.MaxTextureSize, maxTextureWidth); this.ttfTexture = FontTextureHelper.GetTTFTexture(fontFilename, fontHeight, maxTextureWidth[0], firstChar, lastChar); }
/// <summary> /// 用一个纹理绘制指定范围内的可见字符 /// </summary> /// <param name="fontFilename">字体文件名</param> /// <param name="fontHeight">此值越大,绘制文字的清晰度越高,但占用的纹理资源就越多。</param> /// <param name="firstChar">要显示的第一个字符</param> /// <param name="lastChar">要显示的最后一个字符</param> public WholeFontTextureElement(string textureFilename, string xmlFilename) { this.ttfTexture = FontTextureHelper.GetTTFTexture(textureFilename, xmlFilename); }