示例#1
0
 internal Font(Workbook wb, FontRecord f) : base(wb)
 {
     _height       = f.FontHeight;
     _options      = f.Options;
     _color        = wb.Palette.GetColor(f.ColorIdx);
     _boldNess     = f.Boldness;
     _escapement   = f.Escapement;
     _underline    = f.Underline;
     _family       = f.FontFamily;
     _characterSet = f.CharacterSet;
     _fontName     = f.FontName;
 }
示例#2
0
        /// <summary>
        /// The constructor for the record.
        /// </summary>
        /// <param name="biff">The GenericBiff record that should contain the correct type and data for the FONT record.</param>
        /// <exception cref="InvalidRecordIdException">
        /// An InvalidRecordIdException is thrown if biff contains an invalid type or invalid data.
        /// </exception>
        public FontRecord(GenericBiff biff)
        {
            if (biff.Id == (ushort)RecordType.Font)
            {
                BinaryReader reader = new BinaryReader(biff.GetDataStream());

                _fontHeight   = reader.ReadUInt16();
                _options      = (FontOptions)reader.ReadUInt16();
                _colorIdx     = reader.ReadUInt16();
                _boldness     = new FontBoldness(reader.ReadUInt16());
                _escapement   = (FontEscape)reader.ReadUInt16();
                _underline    = (FontUnderline)reader.ReadByte();
                _fontFamily   = (FontFamily)reader.ReadByte();
                _characterSet = (FontCharacterSet)reader.ReadByte();
                byte reserved = reader.ReadByte();
                byte len      = reader.ReadByte();
                _fontName = Reader.ReadComplexString(reader, len);
            }
            else
            {
                throw new InvalidRecordIdException(biff.Id, RecordType.Font);
            }
        }