@@ -967,6 +967,57 @@ public void TrueTypeHinting_CanHintSmallOpenSans(char c, FontRectangle expected)
967967 Assert . Equal ( expected , actual , Comparer ) ;
968968 }
969969
970+ [ Theory ]
971+ [ InlineData ( "aaaa" , 0 , 134.0 ) ]
972+ [ InlineData ( "awwa" , 0 , 162.1 ) ]
973+ [ InlineData ( "aaaa" , 0.1 , 153.3 ) ]
974+ [ InlineData ( "awwa" , 0.1 , 181.4 ) ]
975+ [ InlineData ( "aaaa" , 1 , 326.1 ) ]
976+ [ InlineData ( "awwa" , 1 , 354.1 ) ]
977+ public void FontTracking_SpaceCharacters ( string text , float tracking , float width )
978+ {
979+ Font font = new FontCollection ( ) . Add ( TestFonts . OpenSansFile ) . CreateFont ( 64 ) ;
980+ TextOptions options = new ( font )
981+ {
982+ Tracking = tracking ,
983+ } ;
984+
985+ FontRectangle actual = TextMeasurer . MeasureSize ( text , options ) ;
986+ Assert . Equal ( new FontRectangle ( 0 , 0 , width , 35.4f ) , actual , Comparer ) ;
987+ }
988+
989+ [ Theory ]
990+ [ InlineData ( "\u1B3C " , 1 , 83.8 ) ]
991+ [ InlineData ( "\u1B3C \u1B3C " , 1 , 83.8 ) ]
992+ public void FontTracking_DoNotAddSpacingAfterCharacterThatDidNotAdvance ( string text , float tracking , float width )
993+ {
994+ Font font = new FontCollection ( ) . Add ( TestFonts . NotoSansBalineseRegular ) . CreateFont ( 64 ) ;
995+ TextOptions options = new ( font )
996+ {
997+ Tracking = tracking ,
998+ } ;
999+
1000+ FontRectangle actual = TextMeasurer . MeasureSize ( text , options ) ;
1001+ Assert . Equal ( new FontRectangle ( 0 , 0 , width , 103.3f ) , actual , Comparer ) ;
1002+ }
1003+
1004+ [ Theory ]
1005+ [ InlineData ( "\u093f " , 1 , 48.4 ) ]
1006+ [ InlineData ( "\u0930 \u094D \u0915 \u093F " , 1 , 225.6 ) ]
1007+ [ InlineData ( "\u0930 \u094D \u0915 \u093F \u0930 \u094D \u0915 \u093F " , 1 , 419 ) ]
1008+ [ InlineData ( "\u093f a" , 1 , 145.5f ) ]
1009+ public void FontTracking_CorrectlyAddSpacingForComposedCharacter ( string text , float tracking , float width )
1010+ {
1011+ Font font = new FontCollection ( ) . Add ( TestFonts . NotoSansDevanagariRegular ) . CreateFont ( 64 ) ;
1012+ TextOptions options = new ( font )
1013+ {
1014+ Tracking = tracking ,
1015+ } ;
1016+
1017+ FontRectangle actual = TextMeasurer . MeasureSize ( text , options ) ;
1018+ Assert . Equal ( width , actual . Width , Comparer ) ;
1019+ }
1020+
9701021 [ Fact ]
9711022 public void CanMeasureTextAdvance ( )
9721023 {
0 commit comments