Skip to content

Commit 43af469

Browse files
committed
reduction lines
1 parent d1b397f commit 43af469

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

nico.nim

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,10 +2254,8 @@ proc print*(text: string, x,y: Pint, scale: Pint = 1) =
22542254
## prints a string using the current font
22552255
if currentFont == nil:
22562256
raise newException(Exception, "No font selected")
2257-
var tx = x
2258-
var ty = y
2259-
let ix = x
2260-
let lineHeight = fontHeight() * scale + scale
2257+
var tx = x; var ty = y
2258+
let ix = x; let lineHeight = fontHeight() * scale + scale
22612259
for line in text.splitLines:
22622260
for c in line.runes:
22632261
tx += glyph(c, tx, ty, scale)
@@ -2295,9 +2293,8 @@ proc textWidth*(text: string, scale: Pint = 1): Pint =
22952293
## returns the width of a string in the current font
22962294
if currentFont == nil:
22972295
raise newException(Exception, "No font selected")
2298-
var lineWidth: int
22992296
for line in text.splitLines:
2300-
lineWidth = 0
2297+
var lineWidth = 0
23012298
for c in line.runes:
23022299
if not currentFont.rects.hasKey(c):
23032300
let unknown = '?'.Rune

0 commit comments

Comments
 (0)