예제 #1
0
파일: FeContent.cs 프로젝트: pacojq/Ferret
        /// <summary>
        ///
        /// </summary>
        /// <param name="path">Path to a TTF font</param>
        /// <param name="size">Size of the font</param>
        public static Font LoadFont(string path, int size, char defaultChar = '_')
        {
            // TODO try/catch FileNotFoundException and look for the font in the system

            path = CheckFilename(path, ".ttf");
            FontLibrary lib = new FontLibrary(File.OpenRead(path), FeGame.Instance.GraphicsDevice);
            Font        fnt = lib.CreateFont(size);

            fnt.DefaultCharacter = defaultChar;
            fnt.PreheatCache("asdfghjklñqwertyuiopzxcvbnm");
            return(fnt);
        }