class TTFunk::Table::Dsig

Digital Signature (‘DSIG`) table.

Constants

TAG

Table tag.

Attributes

flags[R]

Permission flags. @return [Integer]

signatures[R]

Signature records. @return [Array<SignatureRecord>]

version[R]

Version umber of this table. @return [Integer]

Public Class Methods

encode(dsig) click to toggle source

Encode table.

Note: all signatures will be lost. This encodes an empty table regardless whether the supplied table contains any signtaures or not.

@param dsig [TTFunk::Table::Dsig] @return [String]

# File lib/ttfunk/table/dsig.rb, line 59
def self.encode(dsig)
  return unless dsig

  # Don't attempt to re-sign or anything - just use dummy values.
  # Since we're subsetting that should be permissible.
  [dsig.version, 0, 0].pack('Nnn')
end

Public Instance Methods

tag() click to toggle source

Table tag.

@return [String]

# File lib/ttfunk/table/dsig.rb, line 70
def tag
  TAG
end

Private Instance Methods

parse!() click to toggle source
# File lib/ttfunk/table/dsig.rb, line 76
def parse!
  @version, num_signatures, @flags = read(8, 'Nnn')

  @signatures =
    Array.new(num_signatures) {
      format, length, sig_offset = read(12, 'N3')
      signature =
        parse_from(offset + sig_offset) {
          _, _, sig_length = read(8, 'nnN')
          read(sig_length, 'C*')
        }

      SignatureRecord.new(format, length, sig_offset, signature)
    }
end