@@ -224,11 +224,9 @@ proc copy*(font: Font): Font {.raises: [].} =
224224 result .strikethrough = font.strikethrough
225225 result .noKerningAdjustments = font.noKerningAdjustments
226226
227- proc newSpan * (text: string , font: Font ): Span {.raises : [].} =
227+ proc newSpan * (text: sink string , font: Font ): Span {.raises : [].} =
228228 # # Creates a span, associating a font with the text.
229- result = Span ()
230- result .text = text
231- result .font = font
229+ result = Span (text: text, font: font)
232230
233231proc convertTextCase (runes: var seq [Rune ], textCase: TextCase ) =
234232 case textCase:
@@ -251,7 +249,7 @@ proc canWrap(rune: Rune): bool {.inline.} =
251249 rune == Rune (32 ) or rune.isWhiteSpace ()
252250
253251proc typeset * (
254- spans: seq [Span ],
252+ spans: openarray [Span ],
255253 bounds = vec2 (0 , 0 ),
256254 hAlign = LeftAlign ,
257255 vAlign = TopAlign ,
@@ -464,7 +462,7 @@ proc typeset*(
464462
465463proc typeset * (
466464 font: Font ,
467- text: string ,
465+ text: sink string ,
468466 bounds = vec2 (0 , 0 ),
469467 hAlign = LeftAlign ,
470468 vAlign = TopAlign ,
@@ -476,7 +474,7 @@ proc typeset*(
476474 # # hAlign: horizontal alignment of the text
477475 # # vAlign: vertical alignment of the text
478476 # # wrap: enable/disable text wrapping
479- typeset (@ [newSpan (text, font)], bounds, hAlign, vAlign, wrap)
477+ typeset ([newSpan (text, font)], bounds, hAlign, vAlign, wrap)
480478
481479proc layoutBounds * (arrangement: Arrangement ): Vec2 {.raises : [].} =
482480 # # Computes the width and height of the arrangement in pixels.
@@ -617,7 +615,7 @@ proc fillText*(
617615proc fillText * (
618616 target: Image ,
619617 font: Font ,
620- text: string ,
618+ text: sink string ,
621619 transform = mat3 (),
622620 bounds = vec2 (0 , 0 ),
623621 hAlign = LeftAlign ,
@@ -656,7 +654,7 @@ proc strokeText*(
656654proc strokeText * (
657655 target: Image ,
658656 font: Font ,
659- text: string ,
657+ text: sink string ,
660658 transform = mat3 (),
661659 strokeWidth: float32 = 1.0 ,
662660 bounds = vec2 (0 , 0 ),
0 commit comments