font api tests
This commit is contained in:
parent
082f16096f
commit
2694a67c52
2 changed files with 31 additions and 4 deletions
|
@ -332,7 +332,6 @@ proc fillText*(
|
|||
mask: Mask,
|
||||
font: Font,
|
||||
text: string,
|
||||
color: SomeColor,
|
||||
transform: Vec2 | Mat3 = vec2(0, 0)
|
||||
) =
|
||||
for path in font.typeset(text):
|
||||
|
@ -342,7 +341,6 @@ proc strokeText*(
|
|||
image: Image,
|
||||
font: Font,
|
||||
text: string,
|
||||
pos = vec2(0, 0),
|
||||
color: SomeColor,
|
||||
transform: Vec2 | Mat3 = vec2(0, 0),
|
||||
strokeWidth = 1.0
|
||||
|
@ -354,7 +352,6 @@ proc strokeText*(
|
|||
mask: Mask,
|
||||
font: Font,
|
||||
text: string,
|
||||
color: SomeColor,
|
||||
transform: Vec2 | Mat3 = vec2(0, 0),
|
||||
strokeWidth = 1.0
|
||||
) =
|
||||
|
|
|
@ -1,4 +1,34 @@
|
|||
import pixie, strformat
|
||||
import pixie, pixie/fileformats/png, strformat
|
||||
|
||||
block:
|
||||
let font = readFont("tests/fonts/Roboto-Regular.ttf")
|
||||
font.size = 64
|
||||
let image = newImage(200, 100)
|
||||
image.fill(rgba(255, 255, 255, 255))
|
||||
image.filLText(font, "fill", rgba(0, 0, 0, 255))
|
||||
image.writeFile("tests/fonts/image_fill.png")
|
||||
|
||||
block:
|
||||
let font = readFont("tests/fonts/Roboto-Regular.ttf")
|
||||
font.size = 64
|
||||
let image = newImage(200, 100)
|
||||
image.fill(rgba(255, 255, 255, 255))
|
||||
image.strokeText(font, "stroke", rgba(0, 0, 0, 255))
|
||||
image.writeFile("tests/fonts/image_stroke.png")
|
||||
|
||||
block:
|
||||
let font = readFont("tests/fonts/Roboto-Regular.ttf")
|
||||
font.size = 64
|
||||
let mask = newMask(200, 100)
|
||||
mask.fillText(font, "fill")
|
||||
writeFile("tests/fonts/mask_fill.png", mask.encodePng())
|
||||
|
||||
block:
|
||||
let font = readFont("tests/fonts/Roboto-Regular.ttf")
|
||||
font.size = 64
|
||||
let mask = newMask(200, 100)
|
||||
mask.strokeText(font, "stroke")
|
||||
writeFile("tests/fonts/mask_stroke.png", mask.encodePng())
|
||||
|
||||
proc doDiff(rendered: Image, name: string) =
|
||||
let
|
||||
|
|
Loading…
Reference in a new issue