Exemplo n.º 1
0
        bool LoadFont()
        {
            // Load font
            string filename = font.ToString() + ".FNT";

            if (!fntFile.Load(Path.Combine(DaggerfallUI.Instance.FontsFolder, filename), FileUsage.UseMemory, true))
            {
                throw new Exception("DaggerfallFont failed to load font " + filename);
            }

            // Start new glyph dictionary
            // Daggerfall fonts start at ASCII 33 '!' so we must create our own space glyph for ASCII 32
            ClearGlyphs();
            AddGlyph(SpaceCode, CreateSpaceGlyph());

            // Add remaining glyphs
            int ascii = asciiStart;

            for (int i = 0; i < FntFile.MaxGlyphCount; i++)
            {
                AddGlyph(ascii++, CreateGlyph(i));
            }

            GlyphHeight = fntFile.FixedHeight;

            // Create font atlas
            ImageProcessing.CreateFontAtlas(fntFile, Color.clear, Color.white, out atlasTexture, out atlasRects);
            atlasTexture.filterMode = FilterMode;

            // Load an SDF font variant if one is available
            LoadSDFFontAsset(string.Format("Fonts/{0}-SDF", font.ToString()));

            return(true);
        }
Exemplo n.º 2
0
        void LoadFont()
        {
            string filename = fontSelection.ToString() + ".FNT";

            if (fntFile.Load(Path.Combine(dfUnity.Arena2Path, filename), FileUsage.UseMemory, true))
            {
                lastFontSelection = fontSelection;
            }
        }