Ejemplo n.º 1
0
        public BMPFontBinaryLoader(Stream stream)
        {
            this.stream = stream;

            BinaryReader binaryReader = new BinaryReader(stream, Encoding.ASCII);

            r = new BMPFontReader(binaryReader);

            char fid1 = (char)r.ReadByte();
            char fid2 = (char)r.ReadByte();
            char fid3 = (char)r.ReadByte();

            if (fid1 != 'B' || fid2 != 'M' || fid3 != 'F')
            {
                throw new InvalidDataException("Failed to load binary angel font, specified file is not a binary angel bmp file!");
            }

            byte version = r.ReadByte();

            if (version != 3)
            {
                throw new NotSupportedException("Failed to load binary angel font, only version 3 is currently supported!");
            }
        }
Ejemplo n.º 2
0
        public override InfoBlock GetInfoBlock()
        {
            byte blockId   = r.ReadByte();
            int  blockSize = r.ReadInt16();

            InfoBlock block = new InfoBlock();

            block.FontSize = r.ReadInt16();
            byte bitField = r.ReadByte();

            block.IsSmooth      = r.GetBit(bitField, 0);
            block.IsUnicode     = r.GetBit(bitField, 1);
            block.IsItalic      = r.GetBit(bitField, 2);
            block.IsBold        = r.GetBit(bitField, 3);
            block.IsFixedHeight = r.GetBit(bitField, 4);
            block.CharSet       = r.ReadByte();
            block.StretchH      = r.ReadUInt16();
            block.AA            = r.ReadByte();
            block.PaddingUp     = r.ReadByte();
            block.PaddingRight  = r.ReadByte();
            block.PaddingDown   = r.ReadByte();
            block.PaddingLeft   = r.ReadByte();
            block.SpacingHoriz  = r.ReadByte();
            block.SpacingVert   = r.ReadByte();
            block.Outline       = r.ReadByte();
            block.FontName      = r.ReadString();

            return(block);
        }