all files / fontkit/playground/ subset.coffee

0% Statements 0/17
100% Branches 0/0
0% Functions 0/1
0% Lines 0/17
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                                                 
#import "../ttf"
#import "../subset"
 
font = TTFFont.open '/Library/Fonts/BigCaslon.ttf'
glyphs = font.glyphsForString "I'm thirsty!", ['ccmp', 'liga', 'dlig', 'frac']
console.log glyphs
 
subset = new TTFSubset font
for glyph in glyphs
    subset.includeGlyph glyph
    
fs = require 'fs'
stream = fs.createWriteStream('out.ttf')
subset.encode(stream)
stream.end()
 
console.log '------------------------'
assert  =require 'assert'
stream.on 'close', ->
    sub = TTFFont.open 'out.ttf'
    console.log sub.directory
    
    assert.deepEqual sub.head, font.head
    # assert.deepEqual sub.hhea, font.hhea
    console.log sub.cmap