diff --git a/src/pixie.nim b/src/pixie.nim index d9b066a..f60b012 100644 --- a/src/pixie.nim +++ b/src/pixie.nim @@ -339,7 +339,7 @@ proc fillText*( wrap = true, kerning = true ) = - for path in font.typeset( + for _, path in font.typeset( text, bounds, hAlign, @@ -362,7 +362,7 @@ proc fillText*( wrap = true, kerning = true ) = - for path in font.typeset( + for _, path in font.typeset( text, bounds, hAlign, @@ -387,7 +387,7 @@ proc strokeText*( wrap = true, kerning = true ) = - for path in font.typeset( + for _, path in font.typeset( text, bounds, hAlign, @@ -411,7 +411,7 @@ proc strokeText*( wrap = true, kerning = true ) = - for path in font.typeset( + for _, path in font.typeset( text, bounds, hAlign, diff --git a/src/pixie/fonts.nim b/src/pixie/fonts.nim index e4a8ebd..2a7bdc8 100644 --- a/src/pixie/fonts.nim +++ b/src/pixie/fonts.nim @@ -255,14 +255,16 @@ proc typeset*( result.positions[i].y += yAdjustment result.selectionRects[i].y += yAdjustment -iterator paths*(arrangement: Arrangement): Path = +proc getPath*(arrangement: Arrangement, i: int): Path = + result = arrangement.font.typeface.getGlyphPath(arrangement.runes[i]) + result.transform( + translate(arrangement.positions[i]) * scale(vec2(arrangement.font.scale)) + ) + +iterator paths*(arrangement: Arrangement): (int, Path) = for i in 0 ..< arrangement.runes.len: if arrangement.runes[i].uint32 > SP.uint32: # Don't draw control runes - var path = arrangement.font.typeface.getGlyphPath(arrangement.runes[i]) - path.transform( - translate(arrangement.positions[i]) * scale(vec2(arrangement.font.scale)) - ) - yield path + yield (i, arrangement.getPath(i)) proc parseOtf*(buf: string): Font = result.typeface = Typeface()