Пример #1
0
        public BitmapFont(Font font, FontBuilderConfiguration config)
        {
            if (config == null)
                config = new FontBuilderConfiguration();

            fontData = BuildFont(font, config, null);
        }
Пример #2
0
        public BitmapFont(string fileName, float size, FontStyle style, FontBuilderConfiguration config)
        {
            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 FontBuilderConfiguration();

            float fontScale = 1f;

            using (var font = new Font(fontFamily, size * fontScale * config.SuperSampleLevels, style))
            {
                fontData = BuildFont(font, config, null);
            }
        }
Пример #3
0
 private static FontData BuildFont(Font font, FontBuilderConfiguration config, string saveName)
 {
     Builder builder = new Builder(font, config);
     return builder.BuildFontData(saveName);
 }
Пример #4
0
 public BitmapFont(string fileName, float size, FontBuilderConfiguration config)
     : this(fileName, size, FontStyle.Regular, config)
 {
 }
Пример #5
0
        public static void CreateTextureFontFiles(string fileName, float size, FontStyle style, FontBuilderConfiguration config, string newFontName)
        {
            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);

            FontData fontData = null;
            if (config == null)
                config = new FontBuilderConfiguration();

            using (var font = new Font(fontFamily, size * config.SuperSampleLevels, style))
            {
                fontData = BuildFont(font, config, newFontName);
            }

            Builder.SaveQFontDataToFile(fontData, newFontName);
        }
Пример #6
0
 public static void CreateTextureFontFiles(string fileName, float size, FontBuilderConfiguration config, string newFontName)
 {
     CreateTextureFontFiles(fileName, size, FontStyle.Regular, config, newFontName);
 }
Пример #7
0
 public static void CreateTextureFontFiles(Font font, string newFontName, FontBuilderConfiguration config)
 {
     var fontData = BuildFont(font, config, newFontName);
     Builder.SaveQFontDataToFile(fontData, newFontName);
 }
Пример #8
0
 public Builder(Font font, FontBuilderConfiguration config)
 {
     this.charSet = config.charSet;
     this.config = config;
     this.font = font;
 }