Пример #1
0
        /// <summary>
        /// Repopulates the character widths from the given font.
        /// </summary>
        /// <param name="font">The font to be read from.</param>
        public void ReadFrom(NitroFont font)
        {
            IList <int>       codes      = font.Codes;
            IList <Character> characters = font.Characters;

            this.xOffsets    = new byte[characters.Count];
            this.widths      = new byte[characters.Count];
            this.nextOffsets = new byte[characters.Count];

            for (int i = 0; i < codes.Count; i++)
            {
                Character character = font.GetCharacter(codes[i]);
                this.xOffsets[i]    = character.XOffset;
                this.widths[i]      = character.Width;
                this.nextOffsets[i] = character.NextOffset;
            }
        }
Пример #2
0
        /// <summary>
        /// Repopulates the graphical glyphs from the given font.
        /// </summary>
        /// <param name="font">The font to be read from.</param>
        public void ReadFrom(NitroFont font)
        {
            IList <int>       codes      = font.Codes;
            IList <Character> characters = font.Characters;

            this.characterCount = characters.Count;

            List <Bitmap> newGlyphs = new List <Bitmap>(this.characterCount);

            foreach (int code in codes)
            {
                Character character = font.GetCharacter(code);
                newGlyphs.Add(new Bitmap(character.Glyph));
            }

            foreach (Bitmap bitmap in this.glyphs)
            {
                bitmap.Dispose();
            }

            this.glyphs = newGlyphs;
        }