Beispiel #1
0
        public GLFont(Font font, GLFontBuilderConfiguration config = null)
        {
            options = new GLFontRenderOptions();

            if (config == null)
            {
                config = new GLFontBuilderConfiguration();
            }

            fontData = new GLFontBuilder(font, config).BuildFontData();
        }
Beispiel #2
0
        public GLFont(string fileName, float size, GLFontBuilderConfiguration config, FontStyle style = FontStyle.Regular)
        {
            PrivateFontCollection pfc = new PrivateFontCollection();

            pfc.AddFontFile(fileName);
            var fontFamily = pfc.Families[0];

            if (!fontFamily.IsStyleAvailable(style))
            {
                throw new ArgumentException("Font file: " + fileName + " does not support style: " + style);
            }

            if (config == null)
            {
                config = new GLFontBuilderConfiguration();
            }

            using (var font = new Font(fontFamily, size * config.SuperSampleLevels, style))
            {
                fontData = new GLFontBuilder(font, config).BuildFontData();
            }
            pfc.Dispose();
        }
Beispiel #3
0
 public GLFontBuilder(Font font, GLFontBuilderConfiguration config)
 {
     this.charSet = config.CharSet;
     this.config  = config;
     this.font    = font;
 }