// Token: 0x06000217 RID: 535 RVA: 0x0000A398 File Offset: 0x00009398 private void ReadBytes(Bytes bytes) { byte[] byteArray = bytes.ByteArray; this._height = BitConverter.ToUInt16(byteArray, 0); this.SetOptionsValue(bytes.Get(2, 2)); this._colorIndex = BitConverter.ToUInt16(byteArray, 4); this._weight = FontWeightConverter.Convert(BitConverter.ToUInt16(byteArray, 6)); this._escapement = (EscapementTypes)BitConverter.ToUInt16(byteArray, 8); this._underline = (UnderlineTypes)byteArray[10]; this._fontFamily = (FontFamilies)byteArray[11]; this._characterSet = (CharacterSets)byteArray[12]; this._fontName = UnicodeBytes.Read(bytes.Get(14, bytes.Length - 14), 8); }
private void ReadBytes(Bytes bytes) { byte[] byteArray = bytes.ByteArray; _height = BitConverter.ToUInt16(byteArray, 0); SetOptionsValue(bytes.Get(2, 2)); _color = _doc.Workbook.Palette.GetColor(BitConverter.ToUInt16(byteArray, 4)); _weight = FontWeightConverter.Convert(BitConverter.ToUInt16(byteArray, 6)); _escapement = (EscapementTypes)BitConverter.ToUInt16(byteArray, 8); _underline = (UnderlineTypes)byteArray[10]; _fontFamily = (FontFamilies)byteArray[11]; _characterSet = (CharacterSets)byteArray[12]; //skip byte index 13 _fontName = UnicodeBytes.Read(bytes.Get(14, bytes.Length - 14), 8); }
public void FontWeightConverterConvert() { Dictionary <ushort, FontWeight> testItems = new Dictionary <ushort, FontWeight>(); testItems.Add(0, FontWeight.Thin); testItems.Add(99, FontWeight.Thin); testItems.Add(100, FontWeight.Thin); testItems.Add(449, FontWeight.Normal); testItems.Add(450, FontWeight.Normal); testItems.Add(451, FontWeight.Medium); testItems.Add(400, FontWeight.Normal); testItems.Add(900, FontWeight.Heavy); testItems.Add(901, FontWeight.Heavy); testItems.Add(1245, FontWeight.Heavy); foreach (KeyValuePair <ushort, FontWeight> item in testItems) { FontWeight actual = FontWeightConverter.Convert(item.Key); Assert.AreEqual(item.Value, actual, "Should have been {0} but converted {1} to {2}", item.Value, item.Key, actual); } }