@@ -118,8 +118,7 @@ public void Shape_WithSpace_IncludesSpaceGlyph()
118118 public void Shape_WithKerning_ReducesWidth ( )
119119 {
120120 // Arrange
121- var font = OpenTypeFonts . LoadFont ( "Roboto" , FontSubFamily . Regular ) ;
122- var shaper = new TextShaper ( font ) ;
121+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
123122
124123 // Act
125124 var withKerning = shaper . Shape ( "WAVE" , ShapingOptions . Default ) ;
@@ -177,8 +176,7 @@ public void Debug_GposKerningFormat()
177176 public void Shape_AVPair_HasNegativeKerning ( )
178177 {
179178 // Arrange
180- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
181- var shaper = new TextShaper ( font ) ;
179+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
182180
183181 // Act
184182 var withKerning = shaper . Shape ( "AV" ) ;
@@ -197,8 +195,7 @@ public void Shape_AVPair_HasNegativeKerning()
197195 public void Shape_FastOption_StillAppliesKerning ( )
198196 {
199197 // Arrange
200- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
201- var shaper = new TextShaper ( font ) ;
198+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
202199
203200 // Act
204201 var fast = shaper . Shape ( "WAVE" , ShapingOptions . Fast ) ;
@@ -440,8 +437,7 @@ public void MeasureLines_TwoLines_HeightIsDoubleLineHeight()
440437 public void GetLineHeightInPoints_ReturnsPositiveValue ( )
441438 {
442439 // Arrange
443- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
444- var shaper = new TextShaper ( font ) ;
440+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
445441
446442 // Act
447443 float lineHeight = shaper . GetLineHeightInPoints ( 12 ) ;
@@ -456,8 +452,7 @@ public void GetLineHeightInPoints_ReturnsPositiveValue()
456452 public void GetFontHeightInPoints_ReturnsPositiveValue ( )
457453 {
458454 // Arrange
459- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
460- var shaper = new TextShaper ( font ) ;
455+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
461456
462457 // Act
463458 float fontHeight = shaper . GetFontHeightInPoints ( 12 ) ;
@@ -472,8 +467,7 @@ public void GetFontHeightInPoints_ReturnsPositiveValue()
472467 public void GetLineHeight_IsGreaterThanFontHeight ( )
473468 {
474469 // Arrange
475- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
476- var shaper = new TextShaper ( font ) ;
470+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
477471
478472 // Act
479473 float lineHeight = shaper . GetLineHeightInPoints ( 12 ) ;
@@ -488,8 +482,7 @@ public void GetLineHeight_IsGreaterThanFontHeight()
488482 public void GetLineHeight_ScalesWithFontSize ( )
489483 {
490484 // Arrange
491- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
492- var shaper = new TextShaper ( font ) ;
485+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
493486
494487 // Act
495488 float height12 = shaper . GetLineHeightInPoints ( 12 ) ;
@@ -642,8 +635,7 @@ public void Shape_Ligature_PreservesClusterIndex()
642635 public void Shape_DecomposedUnicode_PositionsAccent ( )
643636 {
644637 // Arrange
645- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
646- var shaper = new TextShaper ( font ) ;
638+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
647639
648640 // Act
649641 // U+0065 = 'e', U+0301 = combining acute accent
@@ -671,8 +663,7 @@ public void Shape_DecomposedUnicode_PositionsAccent()
671663 public void Shape_PrecomposedVsDecomposed_SimilarWidth ( )
672664 {
673665 // Arrange
674- var font = OpenTypeFonts . LoadFont ( "Roboto" ) ;
675- var shaper = new TextShaper ( font ) ;
666+ var shaper = OpenTypeFonts . GetTextShaper ( "Roboto" , FontSubFamily . Regular , FontFolders ) ;
676667
677668 // Act
678669 var precomposed = shaper . Shape ( "\u00e9 " ) ; // é (single codepoint)
@@ -695,8 +686,7 @@ public void Shape_PrecomposedVsDecomposed_SimilarWidth()
695686 public void Shape_SourceSans3_SingleMark_PositionsCorrectly ( )
696687 {
697688 // Arrange
698- var font = OpenTypeFonts . LoadFont ( "SourceSans3" ) ;
699- var shaper = new TextShaper ( font ) ;
689+ var shaper = OpenTypeFonts . GetTextShaper ( "SourceSans3" , fontDirectories : FontFolders ) ;
700690
701691 // Act - Single combining mark
702692 var result = shaper . Shape ( "e\u0301 " ) ; // e + combining acute (é)
@@ -724,8 +714,7 @@ public void Shape_SourceSans3_SingleMark_PositionsCorrectly()
724714 public void Shape_Cafe_HandlesDecomposed ( )
725715 {
726716 // Arrange
727- var font = OpenTypeFonts . LoadFont ( "SourceSans3" ) ;
728- var shaper = new TextShaper ( font ) ;
717+ var shaper = OpenTypeFonts . GetTextShaper ( "SourceSans3" , fontDirectories : FontFolders ) ;
729718
730719 // Act - "café" with decomposed é
731720 var result = shaper . Shape ( "cafe\u0301 " ) ;
@@ -745,7 +734,7 @@ public void Shape_Cafe_HandlesDecomposed()
745734 [ TestMethod ]
746735 public void Debug_OpenSans_MarkFeature ( )
747736 {
748- var font = OpenTypeFonts . LoadFont ( "OpenSans" , FontSubFamily . Regular ) ;
737+ var font = OpenTypeFonts . LoadFont ( "OpenSans" , FontSubFamily . Regular , FontFolders ) ;
749738
750739 foreach ( var featureRecord in font . GposTable . FeatureList . FeatureRecords )
751740 {
0 commit comments