all files / fontkit/src/tables/ EBLC.coffee

72.73% Statements 8/11
100% Branches 0/0
0% Functions 0/3
72.73% Lines 8/11
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69                                                                                                                          
r = require 'restructure'
EBDT = require './EBDT'
 
SBitLineMetrics = new r.Struct
  ascender: r.int8
  descender: r.int8
  widthMax: r.uint8
  caretSlopeNumerator: r.int8
  caretSlopeDenominator: r.int8
  caretOffset: r.int8
  minOriginSB: r.int8
  minAdvanceSB: r.int8
  maxBeforeBL: r.int8
  minAfterBL: r.int8
  pad: new r.Reserved(r.int8, 2)
  
CodeOffsetPair = new r.Struct
  glyphCode: r.uint16
  offset: r.uint16
  
IndexSubtable = new r.VersionedStruct r.uint16,
  header:
    imageFormat: r.uint16
    imageDataOffset: r.uint32
    
  1:
    offsetArray: new r.Array(r.uint32, -> @parent.lastGlyphIndex - @parent.firstGlyphIndex + 1)
    
  2:
    imageSize: r.uint32
    bigMetrics: EBDT.BigMetrics
    
  3:
    offsetArray: new r.Array(r.uint16,  -> @parent.lastGlyphIndex - @parent.firstGlyphIndex + 1)
    
  4:
    numGlyphs: r.uint32
    glyphArray: new r.Array(CodeOffsetPair, -> @numGlyphs + 1)
    
  5:
    imageSize: r.uint32
    bigMetrics: EBDT.BigMetrics
    numGlyphs: r.uint32
    glyphCodeArray: new r.Array(r.uint16, 'numGlyphs')
  
IndexSubtableArray = new r.Struct
  firstGlyphIndex: r.uint16
  lastGlyphIndex: r.uint16
  subtable: new r.Pointer(r.uint32, IndexSubtable)
 
BitmapSizeTable = new r.Struct
  indexSubTableArray: new r.Pointer(r.uint32, new r.Array(IndexSubtableArray, 1), type: 'parent')
  indexTablesSize: r.uint32
  numberOfIndexSubTables: r.uint32
  colorRef: r.uint32
  hori: SBitLineMetrics
  vert: SBitLineMetrics
  startGlyphIndex: r.uint16
  endGlyphIndex: r.uint16
  ppemX: r.uint8
  ppemY: r.uint8
  bitDepth: r.uint8
  flags: new r.Bitfield r.uint8, ['horizontal', 'vertical']
 
module.exports = new r.Struct
  version:  r.uint32 # 0x00020000
  numSizes: r.uint32
  sizes:    new r.Array(BitmapSizeTable, 'numSizes')