コード例 #1
0
        public void LoadFontsFromGameData(GameDataManager gd)
        {
            infocardFonts = new Dictionary <int, FontVariations>();

            var v = new FontVariations();

            v.Regular    = GetSystemFont("Agency FB");
            v.Bold       = GetSystemFont("Agency FB", FontStyles.Bold);
            v.Italic     = GetSystemFont("Agency FB", FontStyles.Italic);
            v.BoldItalic = GetSystemFont("Agency FB", FontStyles.Bold | FontStyles.Italic);
            v.Size       = 14;
            infocardFonts.Add(-1, v);

            foreach (var f in gd.GetRichFonts())
            {
                //points = pixels * 72 / 96
                int sz = (int)(f.Size * 72f / 96f);

                var variations = new FontVariations();
                variations.Size       = sz;
                variations.Regular    = GetSystemFont(f.Name, FontStyles.Regular);
                variations.Bold       = GetSystemFont(f.Name, FontStyles.Bold);
                variations.Italic     = GetSystemFont(f.Name, FontStyles.Italic);
                variations.BoldItalic = GetSystemFont(f.Name, FontStyles.Bold | FontStyles.Italic);
                infocardFonts.Add(f.Index, variations);
            }
            _loaded = true;
        }
コード例 #2
0
ファイル: FontManager.cs プロジェクト: bin601/Librelancer
        public void LoadFontsFromGameData(GameDataManager gd)
        {
            infocardFonts = new Dictionary <int, FontDescription>();

            var v = new FontDescription()
            {
                FontName = "Agency FB", FontSize = 16
            };

            infocardFonts.Add(-1, v);
            foreach (var f in gd.GetRichFonts())
            {
                var desc = new FontDescription()
                {
                    FontName = f.Name, FontSize = f.Size
                };
                infocardFonts.Add(f.Index, desc);
            }
            _loaded = true;
        }