public override OTTable GenerateTable() { // create a Motorola Byte Order buffer for the new table MBOBuffer newbuf = new MBOBuffer(8 + (uint)(SizeofDeviceRecord * m_NumberDeviceRecords)); // populate the buffer newbuf.SetUshort(m_TableVersionNumber, (uint)Table_hdmx.FieldOffsets.TableVersionNumber); newbuf.SetShort(m_NumberDeviceRecords, (uint)Table_hdmx.FieldOffsets.NumberDeviceRecords); newbuf.SetInt(SizeofDeviceRecord, (uint)Table_hdmx.FieldOffsets.SizeofDeviceRecord); for (short i = 0; i < m_NumberDeviceRecords; i++) { newbuf.SetByte(((DeviceRecordCache)m_DeviceRecords[i]).PixelSize, (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord) + (uint)DeviceRecord.FieldOffsets.PixelSize); newbuf.SetByte(((DeviceRecordCache)m_DeviceRecords[i]).MaxWidth, (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord) + (uint)DeviceRecord.FieldOffsets.MaxWidth); for (ushort ii = 0; ii < m_NumGlyphs; ii++) { newbuf.SetByte(((DeviceRecordCache)m_DeviceRecords[i]).getWidth(ii), (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord) + (uint)(DeviceRecord.FieldOffsets.Widths + ii)); } // Pad the end with zeros for (uint ii = 0; ii < getNumPadBytes(); ii++) { newbuf.SetByte(0, (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord) + (uint)DeviceRecord.FieldOffsets.Widths + m_NumGlyphs + ii); } } // put the buffer into a Table_hdmx object and return it Table_hdmx hdmxTable = new Table_hdmx("hdmx", newbuf); return(hdmxTable); }
public override OTTable GenerateTable() { // create a Motorola Byte Order buffer for the new table MBOBuffer newbuf = new MBOBuffer( 8 + (uint)(SizeofDeviceRecord * m_NumberDeviceRecords)); // populate the buffer newbuf.SetUshort( m_TableVersionNumber, (uint)Table_hdmx.FieldOffsets.TableVersionNumber ); newbuf.SetShort( m_NumberDeviceRecords, (uint)Table_hdmx.FieldOffsets.NumberDeviceRecords ); newbuf.SetInt( SizeofDeviceRecord, (uint)Table_hdmx.FieldOffsets.SizeofDeviceRecord ); for( short i = 0; i < m_NumberDeviceRecords; i++ ) { newbuf.SetByte(((DeviceRecordCache)m_DeviceRecords[i]).PixelSize, (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord ) + (uint)DeviceRecord.FieldOffsets.PixelSize ); newbuf.SetByte(((DeviceRecordCache)m_DeviceRecords[i]).MaxWidth, (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord ) + (uint)DeviceRecord.FieldOffsets.MaxWidth ); for( ushort ii = 0; ii < m_NumGlyphs; ii++ ) { newbuf.SetByte(((DeviceRecordCache)m_DeviceRecords[i]).getWidth( ii ), (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord ) + (uint)(DeviceRecord.FieldOffsets.Widths + ii )); } // Pad the end with zeros for( uint ii = 0; ii < getNumPadBytes(); ii++ ) { newbuf.SetByte( 0, (uint)Table_hdmx.FieldOffsets.DeviceRecord + (uint)(i * SizeofDeviceRecord ) + (uint)DeviceRecord.FieldOffsets.Widths + m_NumGlyphs + ii ); } } // put the buffer into a Table_hdmx object and return it Table_hdmx hdmxTable = new Table_hdmx("hdmx", newbuf); return hdmxTable; }