/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */

'use strict';

var CFFStrings = [
  '.notdef',
  'space',
  'exclam',
  'quotedbl',
  'numbersign',
  'dollar',
  'percent',
  'ampersand',
  'quoteright',
  'parenleft',
  'parenright',
  'asterisk',
  'plus',
  'comma',
  'hyphen',
  'period',
  'slash',
  'zero',
  'one',
  'two',
  'three',
  'four',
  'five',
  'six',
  'seven',
  'eight',
  'nine',
  'colon',
  'semicolon',
  'less',
  'equal',
  'greater',
  'question',
  'at',
  'A',
  'B',
  'C',
  'D',
  'E',
  'F',
  'G',
  'H',
  'I',
  'J',
  'K',
  'L',
  'M',
  'N',
  'O',
  'P',
  'Q',
  'R',
  'S',
  'T',
  'U',
  'V',
  'W',
  'X',
  'Y',
  'Z',
  'bracketleft',
  'backslash',
  'bracketright',
  'asciicircum',
  'underscore',
  'quoteleft',
  'a',
  'b',
  'c',
  'd',
  'e',
  'f',
  'g',
  'h',
  'i',
  'j',
  'k',
  'l',
  'm',
  'n',
  'o',
  'p',
  'q',
  'r',
  's',
  't',
  'u',
  'v',
  'w',
  'x',
  'y',
  'z',
  'braceleft',
  'bar',
  'braceright',
  'asciitilde',
  'exclamdown',
  'cent',
  'sterling',
  'fraction',
  'yen',
  'florin',
  'section',
  'currency',
  'quotesingle',
  'quotedblleft',
  'guillemotleft',
  'guilsinglleft',
  'guilsinglright',
  'fi',
  'fl',
  'endash',
  'dagger',
  'daggerdbl',
  'periodcentered',
  'paragraph',
  'bullet',
  'quotesinglbase',
  'quotedblbase',
  'quotedblright',
  'guillemotright',
  'ellipsis',
  'perthousand',
  'questiondown',
  'grave',
  'acute',
  'circumflex',
  'tilde',
  'macron',
  'breve',
  'dotaccent',
  'dieresis',
  'ring',
  'cedilla',
  'hungarumlaut',
  'ogonek',
  'caron',
  'emdash',
  'AE',
  'ordfeminine',
  'Lslash',
  'Oslash',
  'OE',
  'ordmasculine',
  'ae',
  'dotlessi',
  'lslash',
  'oslash',
  'oe',
  'germandbls',
  'onesuperior',
  'logicalnot',
  'mu',
  'trademark',
  'Eth',
  'onehalf',
  'plusminus',
  'Thorn',
  'onequarter',
  'divide',
  'brokenbar',
  'degree',
  'thorn',
  'threequarters',
  'twosuperior',
  'registered',
  'minus',
  'eth',
  'multiply',
  'threesuperior',
  'copyright',
  'Aacute',
  'Acircumflex',
  'Adieresis',
  'Agrave',
  'Aring',
  'Atilde',
  'Ccedilla',
  'Eacute',
  'Ecircumflex',
  'Edieresis',
  'Egrave',
  'Iacute',
  'Icircumflex',
  'Idieresis',
  'Igrave',
  'Ntilde',
  'Oacute',
  'Ocircumflex',
  'Odieresis',
  'Ograve',
  'Otilde',
  'Scaron',
  'Uacute',
  'Ucircumflex',
  'Udieresis',
  'Ugrave',
  'Yacute',
  'Ydieresis',
  'Zcaron',
  'aacute',
  'acircumflex',
  'adieresis',
  'agrave',
  'aring',
  'atilde',
  'ccedilla',
  'eacute',
  'ecircumflex',
  'edieresis',
  'egrave',
  'iacute',
  'icircumflex',
  'idieresis',
  'igrave',
  'ntilde',
  'oacute',
  'ocircumflex',
  'odieresis',
  'ograve',
  'otilde',
  'scaron',
  'uacute',
  'ucircumflex',
  'udieresis',
  'ugrave',
  'yacute',
  'ydieresis',
  'zcaron',
  'exclamsmall',
  'Hungarumlautsmall',
  'dollaroldstyle',
  'dollarsuperior',
  'ampersandsmall',
  'Acutesmall',
  'parenleftsuperior',
  'parenrightsuperior',
  '266 ff',
  'onedotenleader',
  'zerooldstyle',
  'oneoldstyle',
  'twooldstyle',
  'threeoldstyle',
  'fouroldstyle',
  'fiveoldstyle',
  'sixoldstyle',
  'sevenoldstyle',
  'eightoldstyle',
  'nineoldstyle',
  'commasuperior',
  'threequartersemdash',
  'periodsuperior',
  'questionsmall',
  'asuperior',
  'bsuperior',
  'centsuperior',
  'dsuperior',
  'esuperior',
  'isuperior',
  'lsuperior',
  'msuperior',
  'nsuperior',
  'osuperior',
  'rsuperior',
  'ssuperior',
  'tsuperior',
  'ff',
  'ffi',
  'ffl',
  'parenleftinferior',
  'parenrightinferior',
  'Circumflexsmall',
  'hyphensuperior',
  'Gravesmall',
  'Asmall',
  'Bsmall',
  'Csmall',
  'Dsmall',
  'Esmall',
  'Fsmall',
  'Gsmall',
  'Hsmall',
  'Ismall',
  'Jsmall',
  'Ksmall',
  'Lsmall',
  'Msmall',
  'Nsmall',
  'Osmall',
  'Psmall',
  'Qsmall',
  'Rsmall',
  'Ssmall',
  'Tsmall',
  'Usmall',
  'Vsmall',
  'Wsmall',
  'Xsmall',
  'Ysmall',
  'Zsmall',
  'colonmonetary',
  'onefitted',
  'rupiah',
  'Tildesmall',
  'exclamdownsmall',
  'centoldstyle',
  'Lslashsmall',
  'Scaronsmall',
  'Zcaronsmall',
  'Dieresissmall',
  'Brevesmall',
  'Caronsmall',
  'Dotaccentsmall',
  'Macronsmall',
  'figuredash',
  'hypheninferior',
  'Ogoneksmall',
  'Ringsmall',
  'Cedillasmall',
  'questiondownsmall',
  'oneeighth',
  'threeeighths',
  'fiveeighths',
  'seveneighths',
  'onethird',
  'twothirds',
  'zerosuperior',
  'foursuperior',
  'fivesuperior',
  'sixsuperior',
  'sevensuperior',
  'eightsuperior',
  'ninesuperior',
  'zeroinferior',
  'oneinferior',
  'twoinferior',
  'threeinferior',
  'fourinferior',
  'fiveinferior',
  'sixinferior',
  'seveninferior',
  'eightinferior',
  'nineinferior',
  'centinferior',
  'dollarinferior',
  'periodinferior',
  'commainferior',
  'Agravesmall',
  'Aacutesmall',
  'Acircumflexsmall',
  'Atildesmall',
  'Adieresissmall',
  'Aringsmall',
  'AEsmall',
  'Ccedillasmall',
  'Egravesmall',
  'Eacutesmall',
  'Ecircumflexsmall',
  'Edieresissmall',
  'Igravesmall',
  'Iacutesmall',
  'Icircumflexsmall',
  'Idieresissmall',
  'Ethsmall',
  'Ntildesmall',
  'Ogravesmall',
  'Oacutesmall',
  'Ocircumflexsmall',
  'Otildesmall',
  'Odieresissmall',
  'OEsmall',
  'Oslashsmall',
  'Ugravesmall',
  'Uacutesmall',
  'Ucircumflexsmall',
  'Udieresissmall',
  'Yacutesmall',
  'Thornsmall',
  'Ydieresissmall',
  '001.000',
  '001.001',
  '001.002',
  '001.003',
  'Black',
  'Bold',
  'Book',
  'Light',
  'Medium',
  'Regular',
  'Roman',
  'Semibold'
];

var CFFEncodingMap = {
  '0': '-reserved-',
  '1': 'hstem',
  '2': '-reserved-',
  '3': 'vstem',
  '4': 'vmoveto',
  '5': 'rlineto',
  '6': 'hlineto',
  '7': 'vlineto',
  '8': 'rrcurveto',
  '9': '-reserved-',
  '10': 'callsubr',
  '11': 'return',
  '12': {
    '3': 'and',
    '4': 'or',
    '5': 'not',
    '9': 'abs',
    '10': 'add',
    '11': 'div',
    '12': 'sub',
    '14': 'neg',
    '15': 'eq',
    '18': 'drop',
    '20': 'put',
    '21': 'get',
    '22': 'ifelse',
    '23': 'random',
    '24': 'mul',
    '26': 'sqrt',
    '27': 'dup',
    '28': 'exch',
    '29': 'index',
    '30': 'roll',
    '34': 'hflex',
    '35': 'flex',
    '36': 'hflex1',
    '37': 'flex1'
  },
  '13': '-reserved-',
  '14': 'endchar',
  '15': '-reserved-',
  '16': '-reserved-',
  '17': '-reserved-',
  '18': 'hstemhm',
  '19': 'hintmask',
  '20': 'cntrmask',
  '21': 'rmoveto',
  '22': 'hmoveto',
  '23': 'vstemhm',
  '24': 'rcurveline',
  '25': 'rlivecurve',
  '26': 'vvcurveto',
  '27': 'hhcurveto',
  '29': 'callgsubr',
  '30': 'vhcurveto',
  '31': 'hvcurveto'
};

var CFFDictDataMap = {
  '0': {
    name: 'version',
    operand: 'SID'
  },
  '1': {
    name: 'Notice',
    operand: 'SID'
  },
  '2': {
    name: 'FullName',
    operand: 'SID'
  },
  '3': {
    name: 'FamilyName',
    operand: 'SID'
  },
  '4': {
    name: 'Weight',
    operand: 'SID'
  },
  '5': {
    name: 'FontBBox',
    operand: [0, 0, 0, 0]
  },
  '6': {
    name: 'BlueValues'
  },
  '7': {
    name: 'OtherBlues'
  },
  '8': {
    name: 'FamilyBlues'
  },
  '9': {
    name: 'FamilyOtherBlues'
  },
  '10': {
    name: 'StdHW'
  },
  '11': {
    name: 'StdVW'
  },
  '12': {
    '0': {
      name: 'Copyright',
      operand: 'SID'
    },
    '1': {
      name: 'IsFixedPitch',
      operand: false
    },
    '2': {
      name: 'ItalicAngle',
      operand: 0
    },
    '3': {
      name: 'UnderlinePosition',
      operand: -100
    },
    '4': {
      name: 'UnderlineThickness',
      operand: 50
    },
    '5': {
      name: 'PaintType',
      operand: 0
    },
    '6': {
      name: 'CharstringType',
      operand: 2
    },
    '7': {
      name: 'FontMatrix',
      operand: [0.001, 0, 0, 0.001, 0 , 0]
    },
    '8': {
      name: 'StrokeWidth',
      operand: 0
    },
    '9': {
      name: 'BlueScale'
    },
    '10': {
      name: 'BlueShift'
    },
    '11': {
      name: 'BlueFuzz'
    },
    '12': {
      name: 'StemSnapH'
    },
    '13': {
      name: 'StemSnapV'
    },
    '14': {
      name: 'ForceBold'
    },
    '17': {
      name: 'LanguageGroup'
    },
    '18': {
      name: 'ExpansionFactor'
    },
    '19': {
      name: 'initialRandomSeed'
    },
    '20': {
      name: 'SyntheticBase',
      operand: null
    },
    '21': {
      name: 'PostScript',
      operand: 'SID'
    },
    '22': {
      name: 'BaseFontName',
      operand: 'SID'
    },
    '23': {
      name: 'BaseFontBlend',
      operand: 'delta'
    }
  },
  '13': {
    name: 'UniqueID',
    operand: null
  },
  '14': {
    name: 'XUID',
    operand: []
  },
  '15': {
    name: 'charset',
    operand: 0
  },
  '16': {
    name: 'Encoding',
    operand: 0
  },
  '17': {
    name: 'CharStrings',
    operand: null
  },
  '18': {
    name: 'Private',
    operand: 'number number'
  },
  '19': {
    name: 'Subrs'
  },
  '20': {
    name: 'defaultWidthX'
  },
  '21': {
    name: 'nominalWidthX'
  }
};

var CFFDictPrivateDataMap = {
  '6': {
    name: 'BluesValues',
    operand: 'delta'
  },
  '7': {
    name: 'OtherBlues',
    operand: 'delta'
  },
  '8': {
    name: 'FamilyBlues',
    operand: 'delta'
  },
  '9': {
    name: 'FamilyOtherBlues',
    operand: 'delta'
  },
  '10': {
    name: 'StdHW',
    operand: null
  },
  '11': {
    name: 'StdVW',
    operand: null
  },
  '12': {
    '9': {
      name: 'BlueScale',
      operand: 0.039625
    },
    '10': {
      name: 'BlueShift',
      operand: 7
    },
    '11': {
      name: 'BlueFuzz',
      operand: 1
    },
    '12': {
      name: 'StemSnapH',
      operand: 'delta'
    },
    '13': {
      name: 'StemSnapV',
      operand: 'delta'
    },
    '14': {
      name: 'ForceBold',
      operand: 'boolean'
    },
    '17': {
      name: 'LanguageGroup',
      operand: 0
    },
    '18': {
      name: 'ExpansionFactor',
      operand: 0.06
    },
    '19': {
      name: 'initialRandomSeed',
      operand: 0
    }
  },
  '19': {
    name: 'Subrs',
    operand: null
  },
  '20': {
    name: 'defaultWidthX',
    operand: 0
  },
  '21': {
    name: 'nominalWidthX',
    operand: 0
  }
};