-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When i want to write a bigger text with a maxWidth in place it does wrap the text but doesn't apply the Alignment
To Reproduce
const fs = require("fs")
const { Image, TextLayout } = require("imagescript")
const maxSize = 600
// add font as needed!
const text = "Thats way to big to fit on one line, please Center it :)"
const font = fs.readFileSync('your font :)')
const genFile = async () => {
const white = Image.rgbToColor(255,255,255)
const params = new TextLayout({
maxWidth: maxSize,
wrapStyle: 'word',
verticalAlign: 'center',
horizontalAlign: 'top'
})
const txt = await Image.renderText(font, 50, text, white, params)
const encoded = await image.encode(1, {creationTime: 0, software: ''});
fs.writeFileSync('./test-is.png', encoded)
}
genFile()
Expected behavior
Align the Text at the center when set in verticalAlign Options and the text got Wrapped.
Platform:
- OS: Windows
- Environment: NodeJS
- Version:
"imagescript": "^1.3.0", "node": "v20.5.1"
Additional context
It doesn't matter if the text gets composite onto another image (as expected).
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working