示例#1
0
        void loadFonts()
        {
            // ==============================================================================================================
            // load Ascii fonts
            // ==============================================================================================================

            using (BinaryReader reader = new BinaryReader(new FileStream(FileManager.GetFilePath("fonts.mul"), FileMode.Open, FileAccess.Read)))
            {
                for (int iFont = 0; iFont < AsciiFontCount; iFont++)
                {
                    m_AsciiFonts[iFont] = new FontAscii();
                    m_AsciiFonts[iFont].Initialize(reader);
                }
            }

            // ==============================================================================================================
            // load Unicode fonts
            // ==============================================================================================================

            int maxHeight = 0; // because all unifonts are designed to be used together, they must all share a maxheight.

            for (int iFont = 0; iFont < UniFontCount; iFont++)
            {
                string path = FileManager.GetFilePath("unifont" + (iFont == 0 ? "" : iFont.ToString()) + ".mul");
                if (path != null)
                {
                    m_UnicodeFonts[iFont] = new FontUnicode();
                    m_UnicodeFonts[iFont].Initialize(new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read)));
                    if (m_UnicodeFonts[iFont].Height > maxHeight)
                        maxHeight = m_UnicodeFonts[iFont].Height;
                }
            }

            for (int iFont = 0; iFont < UniFontCount; iFont++)
            {
                if (m_UnicodeFonts[iFont] == null)
                    continue;
                m_UnicodeFonts[iFont].Height = maxHeight;
            }
        }
示例#2
0
 void LoadFonts()
 {
     // load Ascii fonts
     using (BinaryReader reader = new BinaryReader(new FileStream(FileManager.GetFilePath("fonts.mul"), FileMode.Open, FileAccess.Read)))
     {
         for (int i = 0; i < AsciiFontCount; i++)
         {
             m_AsciiFonts[i] = new FontAscii();
             m_AsciiFonts[i].Initialize(reader);
             m_AsciiFonts[i].HasBuiltInOutline = true;
         }
     }
     // load Unicode fonts
     int maxHeight = 0; // because all unifonts are designed to be used together, they must all share a single maxheight value.
     for (int i = 0; i < UniFontCount; i++)
     {
         string path = FileManager.GetFilePath("unifont" + (i == 0 ? "" : i.ToString()) + ".mul");
         if (path != null)
         {
             m_UnicodeFonts[i] = new FontUnicode();
             m_UnicodeFonts[i].Initialize(new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read)));
             if (m_UnicodeFonts[i].Height > maxHeight)
             {
                 maxHeight = m_UnicodeFonts[i].Height;
             }
         }
     }
     for (int i = 0; i < UniFontCount; i++)
     {
         if (m_UnicodeFonts[i] == null)
         {
             continue;
         }
         m_UnicodeFonts[i].Height = maxHeight;
     }
 }