Exemple #1
0
 public static SpriteFont Get(AvailableFonts font)
 {
     if (ContentHolder.IsInitialized)
     {
         return(ContentHolder.Fonts[font]);
     }
     else
     {
         throw new Exception("You forgot to initialize the ContentManager");
     }
 }
Exemple #2
0
        internal void AddSymbolsFonts(IEnumerable <TrueTypeFont> newFonts)
        {
            Debug.Assert(newFonts != null, "New fonts collection should not be null.");

            AvailableFonts = AvailableFonts != null?newFonts.Concat(AvailableFonts) : newFonts;

            if (SymbolsFont == null)
            {
                SymbolsFont = AvailableFonts.FirstOrDefault();
            }
        }
        public Font GetFont(AvailableFonts afFontChoice, int iSize)
        {
            int iFontIndex = (int)afFontChoice;
            PrivateFontCollection pfc;

            if (m_asFonts[iFontIndex] == null)
            {
                m_asFonts[iFontIndex] = new SmoothFont(C_FILE_NAMES[iFontIndex]);
                pfc = PrepFont(C_FILE_NAMES[iFontIndex]);
                m_asFonts[iFontIndex].Base = pfc.Families[0];
            }

            if (!m_asFonts[iFontIndex].FontsBySize.ContainsKey(iSize))
            {
                m_asFonts[iFontIndex].FontsBySize.Add(iSize, new Font(m_asFonts[iFontIndex].Base, iSize));
            }

            return(m_asFonts[iFontIndex].FontsBySize[iSize]);
        }
Exemple #4
0
        public static string ToFileName(this AvailableFonts fontName)
        {
            switch (fontName)
            {
            case AvailableFonts.MangaTemple:
                return("MangaTemple.ttf");

            case AvailableFonts.AnimeAce:
                return("AnimeAce.ttf");

            case AvailableFonts.OpenSans:
                return("OpenSans.ttf");

            case AvailableFonts.Anton:
                return("Anton.ttf");

            default:
                throw new ArgumentException("Not a valid font");
            }
        }
Exemple #5
0
 public static SpriteFont Get(AvailableFonts font) => ContentHolder.Fonts[font];