@@ -35,6 +35,7 @@ protected override void BeforeImageApply()
3535 this . textRenderer = new CachingGlyphRenderer (
3636 this . Configuration . MemoryAllocator ,
3737 this . definition . Text . Length ,
38+ this . definition . TextOptions ,
3839 this . definition . Pen ,
3940 this . definition . Brush != null ,
4041 this . definition . DrawingOptions . Transform )
@@ -127,7 +128,7 @@ void Draw(List<DrawingOperation> operations, IBrush brush)
127128 for ( int row = firstRow ; row < end ; row ++ )
128129 {
129130 int y = startY + row ;
130- Span < float > span = buffer . GetRowSpan ( row ) . Slice ( offsetSpan ) ;
131+ Span < float > span = buffer . DangerousGetRowSpan ( row ) . Slice ( offsetSpan ) ;
131132 currentApp . Apply ( span , startX , y ) ;
132133 }
133134 }
@@ -173,22 +174,21 @@ private class CachingGlyphRenderer : IColorGlyphRenderer, IDisposable
173174 private readonly bool renderFill ;
174175 private bool rasterizationRequired ;
175176
176- public CachingGlyphRenderer ( MemoryAllocator memoryAllocator , int size , IPen pen , bool renderFill , Matrix3x2 transform )
177+ public CachingGlyphRenderer ( MemoryAllocator memoryAllocator , int size , TextOptions textOptions , IPen pen , bool renderFill , Matrix3x2 transform )
177178 {
178179 this . MemoryAllocator = memoryAllocator ;
179180 this . currentRenderPosition = default ;
180181 this . Pen = pen ;
181182 this . renderFill = renderFill ;
182183 this . renderOutline = pen != null ;
183- this . offset = 2 ;
184+ this . offset = ( int ) textOptions . Font . Size ;
184185 if ( this . renderFill )
185186 {
186187 this . FillOperations = new List < DrawingOperation > ( size ) ;
187188 }
188189
189190 if ( this . renderOutline )
190191 {
191- this . offset = ( int ) MathF . Ceiling ( ( pen . StrokeWidth * 2 ) + 2 ) ;
192192 this . OutlineOperations = new List < DrawingOperation > ( size ) ;
193193 }
194194
@@ -372,7 +372,7 @@ private Buffer2D<float> Render(IPath path)
372372 {
373373 while ( scanner . MoveToNextPixelLine ( ) )
374374 {
375- Span < float > scanline = fullBuffer . GetRowSpan ( scanner . PixelLineY ) ;
375+ Span < float > scanline = fullBuffer . DangerousGetRowSpan ( scanner . PixelLineY ) ;
376376 bool scanlineDirty = scanner . ScanCurrentPixelLineInto ( 0 , xOffset , scanline ) ;
377377
378378 if ( scanlineDirty && ! graphicsOptions . Antialias )
0 commit comments