Code coverage report for fontkit/src/tables/gvar.coffee

Statements: 76.92% (10 / 13)      Branches: 50% (2 / 4)      Functions: 100% (1 / 1)      Lines: 81.82% (9 / 11)      Ignored: none     

All files » fontkit/src/tables/ » gvar.coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281   1   1                   1 1 1 1   1             1  
r = require 'restructure'
 
shortFrac = new r.Fixed 16, 'BE', 14
 
module.exports = new r.Struct
  version: r.uint16
  reserved: new r.Reserved r.uint16
  axisCount: r.uint16
  globalCoordCount: r.uint16
  globalCoords: new r.Pointer(r.uint32, new r.Array(new r.Array(shortFrac, 'axisCount'), 'globalCoordCount'))
  glyphCount: r.uint16
  flags: r.uint16
  offsetToData: r.uint32
 
module.exports.process = (stream) ->
  type = Eif @flags is 1 then r.uint32 else r.uint16
  ptr = new r.Pointer(type, 'void', relativeTo: 'offsetToData', allowNull: no)
  @offsets = new r.Array(ptr, @glyphCount + 1).decode(stream, this)
  
  Iif @flags is 0
    # In short format, offsets are multiplied by 2.
    # This doesn't seem to be documented by Apple, but it
    # is implemented this way in Freetype.
    for offset, i in @offsets
      @offsets[i] = offset * 2
 
  return