Automattic / Automattic/node-canvas

Right-aligned text with leading/trailing spaces rendered incorrectly

Open
#333 9 comments 1 reaction 0 assignees View on GitHub
Bug Help wanted Text & Fonts
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

Using a simple test like this:

``` js
ctx.font = '30px Arial';
ctx.textAlign = 'right';
ctx.strokeRect(100, 100, 100, 100);
ctx.fillText(' foobar', 100, 100);
```

... I'm getting incorrect rendering in latest node-canvas:

![leading_spaces_nodecanvas](https://f.cloud.github.com/assets/383/1248246/9825034c-2aca-11e3-9c72-2d72ee2796b8.png)

compare to the same output in Chrome (and FF):

![leading_spaces_chrome](https://f.cloud.github.com/assets/383/1248249/a2c7b506-2aca-11e3-852f-e0497448e20c.png)

There's a similar problem with trailing spaces.

node-canvas:

![trailing_spaces_nodecanvas](https://f.cloud.github.com/assets/383/1248253/b0f4ac60-2aca-11e3-98af-c4708103911d.png)

Chrome (FF):

![trailing_spaces_chrome](https://f.cloud.github.com/assets/383/1248260/bfb61f18-2aca-11e3-85df-3b2c14dae12d.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.