This commit is contained in:
Ryan Oldenburg 2021-04-30 11:43:47 -05:00
parent 410057806e
commit dc773555a8
2 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import pixie/fontformats/opentype, pixie/fontformats/svgfont, pixie/paths, import pixie/fontformats/opentype, pixie/fontformats/svgfont, pixie/paths,
unicode, vmath unicode, vmath
const AutoLineHeight* = -1.float32 const AutoLineHeight* = -1.float32 ## Use default line height for the font size
type type
Font* = ref object Font* = ref object

View file

@ -8,8 +8,12 @@ font.size = 16
timeIt "typeset": timeIt "typeset":
discard font.typeset(text, vec2(500, 0)) discard font.typeset(text, vec2(500, 0))
let image = newImage(500, 300) let
image = newImage(500, 300)
mask = newMask(500, 300)
timeIt "rasterize": timeIt "rasterize":
image.fill(rgba(255, 255, 255, 255)) # image.fill(rgba(255, 255, 255, 255))
image.fillText(font, text, rgba(0, 0, 0, 255), bounds = image.wh) # image.fillText(font, text, rgba(0, 0, 0, 255), bounds = image.wh)
mask.fill(0)
mask.fillText(font, text, bounds = mask.wh)