Skip to content

Commit

Permalink
reduction lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Angluca committed Dec 31, 2023
1 parent d1b397f commit 43af469
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions nico.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,8 @@ proc print*(text: string, x,y: Pint, scale: Pint = 1) =
## prints a string using the current font
if currentFont == nil:
raise newException(Exception, "No font selected")
var tx = x
var ty = y
let ix = x
let lineHeight = fontHeight() * scale + scale
var tx = x; var ty = y
let ix = x; let lineHeight = fontHeight() * scale + scale
for line in text.splitLines:
for c in line.runes:
tx += glyph(c, tx, ty, scale)
Expand Down Expand Up @@ -2295,9 +2293,8 @@ proc textWidth*(text: string, scale: Pint = 1): Pint =
## returns the width of a string in the current font
if currentFont == nil:
raise newException(Exception, "No font selected")
var lineWidth: int
for line in text.splitLines:
lineWidth = 0
var lineWidth = 0
for c in line.runes:
if not currentFont.rects.hasKey(c):
let unknown = '?'.Rune
Expand Down

0 comments on commit 43af469

Please sign in to comment.