PdfSharp.Fonts.OpenType.IndexToLocationTable.PrepareForCompilation C# (CSharp) Method

PrepareForCompilation() public method

Prepares the font table to be compiled into its binary representation.
public PrepareForCompilation ( ) : void
return void
    public override void PrepareForCompilation()
    {
      DirectoryEntry.Offset = 0;
      if (ShortIndex)
        DirectoryEntry.Length = this.locaTable.Length * 2;
      else
        DirectoryEntry.Length = this.locaTable.Length * 4;

      this.bytes = new byte[DirectoryEntry.PaddedLength];
      int length = this.locaTable.Length;
      int byteIdx = 0;
      if (ShortIndex)
      {
        for (int idx = 0; idx < length; idx++)
        {
          int value = this.locaTable[idx] / 2;
          this.bytes[byteIdx++] = (byte)(value >> 8);
          this.bytes[byteIdx++] = (byte)(value);
        }
      }
      else
      {
        for (int idx = 0; idx < length; idx++)
        {
          int value = this.locaTable[idx];
          this.bytes[byteIdx++] = (byte)(value >> 24);
          this.bytes[byteIdx++] = (byte)(value >> 16);
          this.bytes[byteIdx++] = (byte)(value >> 8);
          this.bytes[byteIdx++] = (byte)value;
        }
      }
      DirectoryEntry.CheckSum = CalcChecksum(this.bytes);
    }
    byte[] bytes;