@@ -37,7 +37,7 @@ public void MeasureBold()
3737 var maxSizePoints = Math . Round ( 300d , 0 , MidpointRounding . AwayFromZero ) . PixelToPoint ( ) ;
3838
3939 var measurer = OpenTypeFonts . GetShaperForFont ( font2 ) ;
40- var widthInPoints = measurer . GetDescentInPoints ( font2 . Size ) ;
40+ var widthInPoints = measurer . ShapeLight ( test ) . GetWidthInPoints ( font2 . Size ) ;
4141
4242 var inPixels = Math . Round ( widthInPoints . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
4343
@@ -54,8 +54,10 @@ public void MeasureGoudy()
5454 Style = MeasurementFontStyles . Regular
5555 } ;
5656
57+ var text = "Goudy size" ;
58+
5759 var measurer = OpenTypeFonts . GetShaperForFont ( font5 ) ;
58- var widthInPoints = measurer . GetDescentInPoints ( font5 . Size ) ;
60+ var widthInPoints = measurer . ShapeLight ( text ) . GetWidthInPoints ( 16f ) ;
5961
6062 var inPixels = Math . Round ( widthInPoints . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
6163
@@ -121,25 +123,25 @@ public void MeasureWrappedWidthsWithInternalLineBreaks()
121123
122124 var line1 = wrappedLines [ 0 ] ;
123125
124- var pixels11 = Math . Round ( line1 . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
126+ var pixels11 = Math . Round ( line1 . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
125127 var pixelsWholeline1 = Math . Round ( line1 . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
126128
127129 Assert . AreEqual ( 44 , pixels11 ) ;
128130 Assert . AreEqual ( pixels11 , pixelsWholeline1 ) ;
129131
130132 var line2 = wrappedLines [ 1 ] ;
131133
132- var pixels21 = Math . Round ( line2 . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
134+ var pixels21 = Math . Round ( line2 . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
133135 var pixelsWholeline2 = Math . Round ( line2 . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
134136
135137 Assert . AreEqual ( 7 , pixels21 ) ;
136138 Assert . AreEqual ( pixels21 , pixelsWholeline2 ) ;
137139
138140 var line3 = wrappedLines [ 2 ] ;
139141
140- var pixels31 = Math . Round ( line3 . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
141- var pixels32 = Math . Round ( line3 . RtFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
142- var pixels33 = Math . Round ( line3 . RtFragments [ 2 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
142+ var pixels31 = Math . Round ( line3 . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
143+ var pixels32 = Math . Round ( line3 . LineFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
144+ var pixels33 = Math . Round ( line3 . LineFragments [ 2 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
143145 var pixelsWholeLine3 = Math . Round ( line3 . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
144146
145147 //~54 px
@@ -154,8 +156,8 @@ public void MeasureWrappedWidthsWithInternalLineBreaks()
154156
155157 var line4 = wrappedLines [ 3 ] ;
156158
157- var pixels41 = Math . Round ( line4 . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
158- var pixels42 = Math . Round ( line4 . RtFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
159+ var pixels41 = Math . Round ( line4 . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
160+ var pixels42 = Math . Round ( line4 . LineFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
159161 var pixelsWholeLine4 = Math . Round ( line4 . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
160162 //~34 px
161163 Assert . AreEqual ( 33 , pixels41 ) ;
@@ -166,8 +168,8 @@ public void MeasureWrappedWidthsWithInternalLineBreaks()
166168
167169 var line5 = wrappedLines [ 4 ] ;
168170
169- var pixels51 = Math . Round ( line5 . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
170- var pixels52 = Math . Round ( line5 . RtFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
171+ var pixels51 = Math . Round ( line5 . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
172+ var pixels52 = Math . Round ( line5 . LineFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
171173 var pixelsWholeLine5 = Math . Round ( line5 . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
172174 Assert . AreEqual ( 35 , pixels51 ) ;
173175 //This line does NOT contain a space at the end
@@ -227,9 +229,9 @@ public void MeasureWrappedWidths()
227229
228230 var wrappedLines = ttMeasurer . WrapRichTextLines ( textFragments , maxSizePoints ) ;
229231
230- var pixels1 = Math . Round ( wrappedLines [ 0 ] . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
231- var pixels2 = Math . Round ( wrappedLines [ 0 ] . RtFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
232- var pixels3 = Math . Round ( wrappedLines [ 0 ] . RtFragments [ 2 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
232+ var pixels1 = Math . Round ( wrappedLines [ 0 ] . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
233+ var pixels2 = Math . Round ( wrappedLines [ 0 ] . LineFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
234+ var pixels3 = Math . Round ( wrappedLines [ 0 ] . LineFragments [ 2 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
233235 var pixelsWholeLine = Math . Round ( wrappedLines [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
234236
235237 //~54 px
@@ -242,8 +244,8 @@ public void MeasureWrappedWidths()
242244 //Total Width: ~140
243245 Assert . AreEqual ( 140d , pixelsWholeLine ) ;
244246
245- var pixels21 = Math . Round ( wrappedLines [ 1 ] . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
246- var pixels22 = Math . Round ( wrappedLines [ 1 ] . RtFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
247+ var pixels21 = Math . Round ( wrappedLines [ 1 ] . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
248+ var pixels22 = Math . Round ( wrappedLines [ 1 ] . LineFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
247249 var pixelsWholeLine2 = Math . Round ( wrappedLines [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
248250 //~34 px
249251 Assert . AreEqual ( 33 , pixels21 ) ;
@@ -252,8 +254,8 @@ public void MeasureWrappedWidths()
252254
253255 Assert . AreEqual ( 281 , pixelsWholeLine2 ) ;
254256
255- var pixels31 = Math . Round ( wrappedLines [ 2 ] . RtFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
256- var pixels32 = Math . Round ( wrappedLines [ 2 ] . RtFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
257+ var pixels31 = Math . Round ( wrappedLines [ 2 ] . LineFragments [ 0 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
258+ var pixels32 = Math . Round ( wrappedLines [ 2 ] . LineFragments [ 1 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
257259 var pixelsWholeLine3 = Math . Round ( wrappedLines [ 2 ] . Width . PointToPixel ( ) , 0 , MidpointRounding . AwayFromZero ) ;
258260 Assert . AreEqual ( 35 , pixels31 ) ;
259261 //This line does NOT contain a space at the end
0 commit comments