Example #1
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);
		}
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Font"/> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="height">The height.</param>
 /// <param name="width">The width.</param>
 /// <param name="weight">The weight.</param>
 /// <param name="mipLevels">The mip levels.</param>
 /// <param name="isItalic">if set to <c>true</c> [is italic].</param>
 /// <param name="characterSet">The character set.</param>
 /// <param name="precision">The precision.</param>
 /// <param name="quality">The quality.</param>
 /// <param name="pitchAndFamily">The pitch and family.</param>
 /// <param name="faceName">Name of the face.</param>
 public Font(Device device, int height, int width, FontWeight weight, int mipLevels, bool isItalic, FontCharacterSet characterSet, FontPrecision precision, FontQuality quality, FontPitchAndFamily pitchAndFamily, string faceName)
 {
     D3DX9.CreateFont(device, height, width, (int)weight, mipLevels, isItalic, (int)characterSet, (int)precision, (int)quality, (int)pitchAndFamily,
                       faceName, this);
 }