Skip to content

fillText with maxWidth 0 breaks subsequent fillText calls #2171

@JacobNorlin

Description

@JacobNorlin

Issue

Any call to fillText after a fillText with maxWidth=0 does not render anything.

Steps to Reproduce

const {createCanvas} = require('canvas');
const fs = require('fs');

const canvas = createCanvas(100, 100);
const context = canvas.getContext('2d');
context.fillStyle = 'white';
context.fillRect(0, 0, 100, 100);

context.font = '12px Arial';
context.fillStyle = 'black';
context.fillText('Test1', 0, 40);
context.fillText('Test2', 0, 60, 0);
context.fillText('Test3', 0, 80);

const buf = canvas.toBuffer();

fs.writeFileSync('test.png', buf);

I would expect 'Test3' to be rendered in this case, but there is nothing rendered.

Your Environment

  • Node canvas 2.10.1
  • Node 16.13.2, Debian 10 (WSL)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions