Code coverage report for fontkit/src/aat/AATLayoutEngine.coffee

Statements: 91.67% (11 / 12)      Branches: 50% (1 / 2)      Functions: 100% (4 / 4)      Lines: 91.67% (11 / 12)      Ignored: none     

All files » fontkit/src/aat/ » AATLayoutEngine.coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231 1 1   1   3         4 4     4 4     1   1  
AATFeatureMap = require './AATFeatureMap'
AATMorxProcessor = require './AATMorxProcessor'
Script = require '../layout/Script'
 
class AATLayoutEngine
  constructor: (@font) ->
    @morxProcessor = new AATMorxProcessor(@font)
    
  substitute: (glyphs, features, script, language) ->
    # AAT expects the glyphs to be in visual order prior to morx processing,
    # so reverse the glyphs if the script is right-to-left.
    isRTL = Script.direction(script) is 'rtl'
    Iif isRTL
      glyphs.reverse()
    
    @morxProcessor.process(glyphs, AATFeatureMap.mapOTToAAT(features))
    return glyphs
    
  getAvailableFeatures: (script, language) ->
    return AATFeatureMap.mapAATToOT @morxProcessor.getSupportedFeatures()
 
module.exports = AATLayoutEngine