File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Processing/Processors/Text Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -477,9 +477,9 @@ private Matrix3x2 ComputeTransform(in FontRectangle bounds)
477477 Vector2 half = new ( bounds . Width * .5F , 0 ) ;
478478 SegmentInfo pathPoint = this . path . PointAlongPath ( bounds . Left + half . X ) ;
479479
480- // Now offset our target point since we're aligning the top-left location of our glyph against the path.
481- Vector2 targetPoint = ( Vector2 ) pathPoint . Point - bounds . Location - half + new Vector2 ( 0 , bounds . Top ) ;
482- return Matrix3x2 . CreateTranslation ( targetPoint ) * Matrix3x2 . CreateRotation ( pathPoint . Angle - MathF . PI , ( Vector2 ) pathPoint . Point ) ;
480+ // Now offset to our target point since we're aligning the top-left location of our glyph against the path.
481+ Vector2 translation = ( Vector2 ) pathPoint . Point - bounds . Location - half + new Vector2 ( 0 , bounds . Top ) ;
482+ return Matrix3x2 . CreateTranslation ( translation ) * Matrix3x2 . CreateRotation ( pathPoint . Angle - MathF . PI , ( Vector2 ) pathPoint . Point ) ;
483483 }
484484
485485 private Buffer2D < float > Render ( IPath path )
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ internal SegmentInfo PointAlongPath(float distanceAlongPath)
171171 // Closed paths will never reach this point.
172172 // For open paths we're going to create a new virtual point that extends past the path.
173173 // The position and angle for that point are calculated based upon the last two points.
174- PointF a = this . points [ this . points . Length >= 2 ? this . points . Length - 2 : 0 ] . Point ;
174+ PointF a = this . points [ Math . Max ( this . points . Length - 2 , 0 ) ] . Point ;
175175 PointF b = this . points [ this . points . Length - 1 ] . Point ;
176176 Vector2 delta = a - b ;
177177 float angle = ( float ) ( Math . Atan2 ( delta . Y , delta . X ) % ( Math . PI * 2 ) ) ;
Original file line number Diff line number Diff line change @@ -43,9 +43,9 @@ private void TransformGlyph(in FontRectangle bounds)
4343 Vector2 half = new ( bounds . Width * .5F , 0 ) ;
4444 SegmentInfo pathPoint = this . path . PointAlongPath ( bounds . Left + half . X ) ;
4545
46- // Now offset our target point since we're aligning the top-left location of our glyph against the path.
47- Vector2 targetPoint = ( Vector2 ) pathPoint . Point - bounds . Location - half + new Vector2 ( 0 , bounds . Top ) ;
48- Matrix3x2 matrix = Matrix3x2 . CreateTranslation ( targetPoint ) * Matrix3x2 . CreateRotation ( pathPoint . Angle - MathF . PI , ( Vector2 ) pathPoint . Point ) ;
46+ // Now offset to our target point since we're aligning the top-left location of our glyph against the path.
47+ Vector2 translation = ( Vector2 ) pathPoint . Point - bounds . Location - half + new Vector2 ( 0 , bounds . Top ) ;
48+ Matrix3x2 matrix = Matrix3x2 . CreateTranslation ( translation ) * Matrix3x2 . CreateRotation ( pathPoint . Angle - MathF . PI , ( Vector2 ) pathPoint . Point ) ;
4949
5050 this . Builder . SetTransform ( matrix ) ;
5151 }
You can’t perform that action at this time.
0 commit comments