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 | 1 1 6 6 6 21 13 21 19 19 21 4 4 4 4 4 1 | r = require 'restructure' class Subset constructor: (@font) -> @glyphs = [] @mapping = {} # always include the missing glyph @includeGlyph 0 includeGlyph: (glyph) -> if typeof glyph is 'object' glyph = glyph.id unless @mapping[glyph]? @glyphs.push glyph @mapping[glyph] = @glyphs.length - 1 return @mapping[glyph] encodeStream: -> s = new r.EncodeStream process.nextTick => @encode s s.end() return s module.exports = Subset |