void LoadFonts()
        {
            // load Ascii fonts
            using (var r = new BinaryReader(new FileStream(UltimaFileManager.GetFilePath("fonts.mul"), FileMode.Open, FileAccess.Read)))
                for (var i = 0; i < AsciiFontCount; i++)
                {
                    _asciiFonts[i] = new FontAscii();
                    _asciiFonts[i].Initialize(r);
                    _asciiFonts[i].HasBuiltInOutline = true;
                }
            // load Unicode fonts
            var maxHeight = 0; // because all unifonts are designed to be used together, they must all share a single maxheight value.

            for (var i = 0; i < UniFontCount; i++)
            {
                var path = UltimaFileManager.GetFilePath($"unifont{(i == 0 ? string.Empty : i.ToString())}.mul");
                if (path != null)
                {
                    _unicodeFonts[i] = new FontUnicode();
                    _unicodeFonts[i].Initialize(new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read)));
                    if (_unicodeFonts[i].Height > maxHeight)
                    {
                        maxHeight = _unicodeFonts[i].Height;
                    }
                }
            }
            for (var i = 0; i < UniFontCount; i++)
            {
                if (_unicodeFonts[i] == null)
                {
                    continue;
                }
                _unicodeFonts[i].Height = maxHeight;
            }
        }
Exemple #2
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;
            }
        }
Exemple #3
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;
            }
        }