Ejemplo n.º 1
0
        private static void CreateFonts(MiyagiSystem system)
        {
            const string FontPath = @"../../../Media/Gfx/Fonts/";
            var          fonts    = new[]
            {
                // load ttf definitions from xml file
                TrueTypeFont.CreateFromXml(Path.Combine(FontPath, "TrueTypeFonts.xml"), system)
                .Cast <Font>().ToDictionary(f => f.Name),
                // load image font definitions from xml file
                ImageFont.CreateFromXml(Path.Combine(FontPath, "ImageFonts.xml"), system)
                .Cast <Font>().ToDictionary(f => f.Name)
            };

            Fonts = fonts.SelectMany(dict => dict)
                    .ToDictionary(pair => pair.Key, pair => pair.Value);

            var font = TrueTypeFont.Create(system, "DejaVuSans", Path.Combine(FontPath, "DejaVuSans.ttf"), 12, 96, System.Drawing.FontStyle.Regular);

            Fonts.Add(font.Name, font);

            // set BlueHighway as default font
            Font.Default = Fonts["BlueHighway"];
        }