@@ -17,6 +17,8 @@ describe('font.js', function() {
1717 fGlyph , iGlyph , ffGlyph , fiGlyph , ffiGlyph
1818 ] ;
1919
20+ glyphs . forEach ( ( glyph , index ) => glyph . index = index ) ;
21+
2022 beforeEach ( function ( ) {
2123 font = new Font ( {
2224 familyName : 'MyFont' ,
@@ -49,6 +51,20 @@ describe('font.js', function() {
4951 } ) ;
5052 } ) ;
5153
54+ describe ( 'stringToGlyphIndexes' , function ( ) {
55+ it ( 'must support standard ligatures' , function ( ) {
56+ assert . deepEqual ( font . stringToGlyphIndexes ( 'fi' ) , [ fGlyph . index , iGlyph . index ] ) ;
57+ font . substitution . add ( 'liga' , { sub : [ 1 , 1 , 2 ] , by : 5 } ) ;
58+ font . substitution . add ( 'liga' , { sub : [ 1 , 1 ] , by : 3 } ) ;
59+ font . substitution . add ( 'liga' , { sub : [ 1 , 2 ] , by : 4 } ) ;
60+ assert . deepEqual ( font . stringToGlyphIndexes ( 'ff' ) , [ ffGlyph . index ] ) ;
61+ assert . deepEqual ( font . stringToGlyphIndexes ( 'fi' ) , [ fiGlyph . index ] ) ;
62+ assert . deepEqual ( font . stringToGlyphIndexes ( 'ffi' ) , [ ffiGlyph . index ] ) ;
63+ assert . deepEqual ( font . stringToGlyphIndexes ( 'fffiffif' ) ,
64+ [ ffGlyph . index , fiGlyph . index , ffiGlyph . index , fGlyph . index ] ) ;
65+ } ) ;
66+ } ) ;
67+
5268 describe ( 'stringToGlyphs' , function ( ) {
5369 it ( 'must support standard ligatures' , function ( ) {
5470 assert . deepEqual ( font . stringToGlyphs ( 'fi' ) , [ fGlyph , iGlyph ] ) ;
0 commit comments