@@ -148,7 +148,7 @@ proc glyph*(c: Rune, x,y: Pint, scale: Pint = 1): Pint {.discardable, inline.}
148
148
proc glyph * (c: char , x,y: Pint , scale: Pint = 1 ): Pint {.discardable , inline .}
149
149
150
150
proc cursor * (x,y: Pint ) # set cursor position
151
- proc print * (text: string ) # print at cursor
151
+ proc print * (text: string , scale: Pint = 1 ) # print at cursor
152
152
proc print * (text: string , x,y: Pint , scale: Pint = 1 )
153
153
proc printc * (text: string , x,y: Pint , scale: Pint = 1 ) # centered
154
154
proc printr * (text: string , x,y: Pint , scale: Pint = 1 ) # right aligned
@@ -2249,21 +2249,23 @@ proc print*(text: string, x,y: Pint, scale: Pint = 1) =
2249
2249
var x = x
2250
2250
var y = y
2251
2251
let ix = x
2252
+ let lineHeight = fontHeight () + scale
2252
2253
for line in text.splitLines:
2253
2254
for c in line.runes:
2254
2255
x += glyph (c, x, y, scale)
2255
2256
x = ix
2256
- y += currentFont.h
2257
+ y += lineHeight
2257
2258
2258
- proc print * (text: string ) =
2259
+ proc print * (text: string , scale: Pint = 1 ) =
2259
2260
# # prints a string using the current font at cursor position
2260
2261
if currentFont == nil :
2261
2262
raise newException (Exception , " No font selected" )
2262
2263
var x = cursorX
2263
2264
let y = cursorY
2265
+ let lineHeight = fontHeight () + scale
2264
2266
for c in text.runes:
2265
- x += glyph (c, x, y, 1 )
2266
- cursorY += 6
2267
+ x += glyph (c, x, y, scale )
2268
+ cursorY += lineHeight
2267
2269
2268
2270
proc glyphWidth * (c: Rune , scale: Pint = 1 ): Pint =
2269
2271
# # returns the width of the glyph in the current font
0 commit comments