Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
83a8df1
Add missing cctype include for toupper
zbjornson Dec 31, 2021
0bccc05
bug: fix process crash in getImageData for PDF/SVG canvases
zbjornson Dec 31, 2021
6fd0fa5
make types compatible with typescript 4.6 (#1986)
chearon Feb 24, 2022
009d594
replace some remaining glib calls
chearon Feb 9, 2022
ddce10f
select fonts via postscript name on Linux
chearon Aug 7, 2021
d7c4673
Add support for multi-byte font path on Windows
tignear Aug 8, 2021
4273771
Fix CI
zbjornson Mar 19, 2022
9d8da5b
v2.9.1
zbjornson Mar 19, 2022
3f3af3a
fix: resolved inconsistent exports in ESM (#2047)
kyranet Jun 16, 2022
1f2b156
Replace binary for rebuild cases (#1982)
Apollon77 Jun 20, 2022
d4dc2a8
v2.9.2
zbjornson Jun 23, 2022
6fa9f38
improve multi-family output in font desc resolver
chearon Jun 24, 2022
7a8a606
v2.9.3
zbjornson Jun 24, 2022
64fdf18
export pangoVersion to help debugging
chearon Jun 27, 2022
b0d4f44
Update instructions for OSX local build
MDOR Jul 7, 2022
5255195
Parse rgba(r,g,b) correctly
zbjornson Jul 7, 2022
f8d4949
Fix FITLER/FILTER typo in index.d.ts
zbjornson Jul 7, 2022
c6a1546
fix repeat-x/y support in createPattern()
calvinsomething Jun 28, 2022
bdc497a
Use node-gyp 8.x for Win CI
zbjornson Aug 5, 2022
288f4bf
add WPT tests
zbjornson Jul 24, 2022
a484cf2
fix crashes and hangs in arc()
zbjornson Jul 27, 2022
73d7893
fix arc geometry calculations
zbjornson Jul 27, 2022
10b208e
un-skip 2d.path.arc.nonfinite; now fixed
zbjornson Aug 5, 2022
eba1e4a
Adds deregisterAllFonts to the typescript declaration file (#2096)
srubin Aug 19, 2022
dce0fd1
Add roundRect() support
zbjornson Aug 5, 2022
3fb4ed9
fix: add user agent to remote images request
Aug 29, 2022
561d933
v2.10.0
zbjornson Sep 4, 2022
6862532
Fix actualBoundingBoxLeft/Right with center/right alignment (#2109)
zbjornson Sep 6, 2022
9374943
Parse rgba(r,g,b,0) correctly
H3r3zy Sep 7, 2022
bc75c6a
add line in CHANGELOG
H3r3zy Sep 7, 2022
b3e7df3
v2.10.1
zbjornson Sep 7, 2022
0e6504a
remove save() limit, improve save/restore perf, fix some props
zbjornson Sep 10, 2022
2876b6e
Bugfix/Node.js 18 -> Assertion failed: (object->InternalFieldCount() …
TheDadi Oct 30, 2022
ad18c6c
src: shorten copy assignment operator decl for Point
zbjornson Oct 30, 2022
cc32159
src: shorten receiver checks
zbjornson Oct 30, 2022
672104c
v2.10.2
zbjornson Oct 30, 2022
40b4382
use tailored types instead of extending DOM
chearon Dec 14, 2022
fc160f5
v2.11.0
zbjornson Dec 22, 2022
9f313df
Add canvas property to CanvasRenderingContext2D type
Suyooo Dec 24, 2022
55d39cb
fix macos CI
chearon Jan 2, 2023
4c276e0
fix incorrect text width with newer (1.43?) Pango
chearon Jan 2, 2023
fdf709a
move ctx.font string to the state struct
chearon Jan 7, 2023
9ecfb70
v2.11.1
chearon Mar 21, 2023
9910243
fix not compiling on certain windows versions
chearon Mar 25, 2023
38e0a32
v2.11.2
chearon Mar 28, 2023
f3184ba
src: refactor and apply fixes
VoltrexKeyva Apr 13, 2023
5902219
add string tags for browser polyglot classes (#2214)
brettz9 Apr 17, 2023
5bd5b24
Upgrade GitHub Actions to use checkout@v3 (#2213)
cclauss Apr 18, 2023
adf73ee
Add node 20 to CI
hargasinski Apr 27, 2023
ce29f69
port to node-addon-api (remove NAN, v8, libuv)
chearon Apr 15, 2023
c9969aa
optimize checkArgs
chearon Apr 17, 2023
16c28ab
optimize fillStyle to be 10% faster
chearon Apr 22, 2023
9b9be4f
fix broken font matching due to a use-after-free
chearon Sep 25, 2023
a5b379b
v3.0.0
zbjornson Oct 4, 2023
7132087
Replace dtslint with tsd
LinusU Nov 28, 2023
ad793da
Drop support for older versions of Node.js (#2310)
LinusU Nov 29, 2023
2c4d2a7
fix the wrong type of setTransform (#2322)
huankong233 Dec 7, 2023
569e8fb
Update actions in GitHub Actions CI
striezel Dec 28, 2023
41428ee
added deregisterAllFonts to readme (#2328)
stepancar Dec 28, 2023
ff0f2ab
Move a changelog entry
zbjornson Dec 28, 2023
25fbac5
switch to prebuild-install
zbjornson Dec 29, 2023
4018095
change OS X to macOS in Readme
himalayanelixir Apr 14, 2024
f934f22
remove use of designated initializers
zbjornson Apr 14, 2024
3f3b2e6
rm prebuild files from master branch
zbjornson Jun 19, 2024
8894635
update installation info in readme
zbjornson Jun 19, 2024
130785f
publish v3.0.0-rc2
zbjornson Jun 19, 2024
3b04bde
add note about v3.0.0-rd2
zbjornson Jun 20, 2024
2de0f8b
Add python-setuptools to MacOS compilation info
zbjornson Jun 20, 2024
20c9882
update prebuild status in readme
zbjornson Jun 23, 2024
7726ea5
run CI on macos-12
zbjornson Jun 23, 2024
e6d55d8
Add fix for alpha '%' parsing
pranav1344 May 18, 2024
b3ecff1
Add support for '/' in rgba
pranav1344 May 18, 2024
3e0b75c
Fix parsing of alpha in RGBA
pranav1344 May 18, 2024
f138b3a
update changelog for 3.0.0
pranav1344 May 18, 2024
83a5126
Fixes related to parsing of colors in RGB functions (#2398)
pranav1344 Jul 15, 2024
ae1aacb
Allow quotes within font-family names
virtulis May 24, 2024
7dfeb04
add TextMetrics properties
musou1500 Jul 9, 2024
ba89686
remove unnecessary call to cairo_get_matrix
chearon Aug 11, 2024
2db6f49
add exif browser tests
chearon Sep 22, 2024
efcde93
Fix class properties should have defaults as standard js classes woul…
mcfedr Sep 27, 2024
a2e10e6
Throw surface errors in toBuffer
mcfedr Jul 18, 2024
77f0b99
Handle Exif orientations for JPEG images (fixes #1670) (#2296)
prewett-toptal Nov 14, 2024
8983c4a
fix windows build (#2458)
chearon Dec 5, 2024
d1ea3f8
fix windows ci config (url went dead)
chearon Dec 6, 2024
22820e1
fix macos ci config (macos-12 was deleted)
chearon Dec 6, 2024
19a3328
v3.0.0-rc3
chearon Dec 7, 2024
d027883
update README wrt macOS/aarch64
chearon Dec 11, 2024
b6b2dc7
modernize node version matrix
chearon Dec 6, 2024
f5894db
fix(DOMMatrix/DOMPoint): spec compatibility
ShaMan123 Aug 31, 2024
a8c035f
Revert "select fonts via postscript name on Linux"
chearon Dec 23, 2024
8346512
v3.0.0
chearon Dec 23, 2024
1817109
add missing DOMMatrixInit and DOMPointInit types
chearon Dec 31, 2024
80e94ea
v3.0.1
chearon Dec 31, 2024
1d956b7
use fetch api
Nov 27, 2023
7ed0a96
add font setter benchmarks
chearon Sep 15, 2024
728e76c
add C++ parser for the font shorthand
chearon Dec 26, 2024
da33bbe
Add link tags for pdfs
mcfedr Jul 18, 2024
a0c8031
getImageData fixes when rectangle is outside of canvas
Oct 26, 2022
0b2edc1
remove reference to old JS parseFont
chearon Jan 12, 2025
52330b8
support ctx.direction and textAlign start/end
chearon Jan 14, 2025
88e9657
allow registerFont after a canvas has been created (#2483)
chearon Jan 18, 2025
61e474e
3.1.0
chearon Jan 22, 2025
2f9de7c
remove unused and un-freed GError
chearon Feb 23, 2025
d24a127
double-free via g_object_unref that could crash
chearon Feb 23, 2025
9d5f104
nicer error reporting when svg width/height missing
chearon Feb 23, 2025
367af8c
fix(deps): update `prebuild-install` to work on Node 22.14+
agilgur5 Mar 29, 2025
494035d
leak in sync toBuffer
chearon Apr 4, 2025
b50b392
added a check to make sure maxWidth > 0
truman126 Mar 17, 2025
c936361
add visual test for #2498
chearon Apr 11, 2025
1234a86
Render at natural dimensions to fix scaling issues
mgilfillan Apr 3, 2025
772c464
fix(TextMetrics): rtl direction + start/end textAlign (#2510)
ShaMan123 Jun 16, 2025
05a53d8
add node 24 to ci
chearon Jun 16, 2025
f5f103a
report correct freed size when resurfacing
chearon Jun 16, 2025
3dca82a
fix build / refactor backends
chearon Jun 18, 2025
627c601
update changelog
chearon Jun 18, 2025
48ecd5a
further backend cleanup, add asserts
chearon Jun 18, 2025
7a942d4
3.1.1
chearon Jun 19, 2025
2738a70
fix resurface crash with png, svg canvases
chearon Jun 26, 2025
a862af8
3.1.2
chearon Jun 26, 2025
6353deb
ci: windows-2025 image (2019 was retired)
chearon Aug 16, 2025
d548caa
use memcpy to avoid misaligned pointer UB
chearon Aug 12, 2025
6ce963d
Set pango language through ctx.lang (#2526)
mapmeld Aug 17, 2025
9bcf363
3.2.0
chearon Aug 17, 2025
418f555
bug: incorrect roundRect() with large radii
zbjornson Sep 7, 2025
616859b
fix: reject loadImage when src is null or invalid (#2518)
Ian-I-Chien Sep 7, 2025
7f34c9b
Fix error message HTTP response status code in image src setter (#2532)
martinwcf Oct 10, 2025
f2c570d
Fix compilation on GCC 15 by including <cstdint> (#2545) (#2546)
skooch Dec 16, 2025
41adf08
v3.2.1
chearon Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ var ctx = canvas.getContext('2d');

## Your Environment
* Version of node-canvas (output of `npm list canvas` or `yarn list canvas`):
* Environment (e.g. node 4.2.0 on Mac OS X 10.8):
* Environment (e.g. node 20.9.0 on macOS 14.1.1):
41 changes: 22 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ on:
paths-ignore:
- ".github/workflows/prebuild.yaml"

jobs:
jobs:
Linux:
name: Test on Linux
runs-on: ubuntu-latest
strategy:
matrix:
node: [10, 12, 14, 16]
node: [18.20.5, 20.18.1, 22.12.0, 23.3.0, 24.2.0]
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt update
Expand All @@ -30,57 +30,60 @@ jobs:

Windows:
name: Test on Windows
runs-on: windows-latest
runs-on: windows-2025
strategy:
matrix:
node: [10, 12, 14, 16]
node: [18.20.5, 20.18.1, 22.12.0, 23.3.0, 24.2.0]
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
Invoke-WebRequest "https://ftp-osl.osuosl.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip" -OutFile "gtk.zip"
Invoke-WebRequest "https://ftp.gnome.org/pub/GNOME/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip" -OutFile "gtk.zip"
Expand-Archive gtk.zip -DestinationPath "C:\GTK"
Invoke-WebRequest "https://downloads.sourceforge.net/project/libjpeg-turbo/2.0.4/libjpeg-turbo-2.0.4-vc64.exe" -OutFile "libjpeg.exe" -UserAgent NativeHost
.\libjpeg.exe /S
winget install --accept-source-agreements --id=Microsoft.VCRedist.2010.x64 -e
npm install -g node-gyp@8
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: Install
run: npm install --build-from-source
- name: Test
run: npm test

macOS:
name: Test on macOS
runs-on: macos-latest
runs-on: macos-15
strategy:
matrix:
node: [10, 12, 14, 16]
node: [18.20.5, 20.18.1, 22.12.0, 23.3.0, 24.2.0]
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
brew update
brew install pkg-config cairo pango libpng jpeg giflib librsvg
brew install python-setuptools pkg-config cairo pango libpng jpeg giflib librsvg
- name: Install
run: npm install --build-from-source
- name: Test
run: npm test
run: npm test

Lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 14
- uses: actions/checkout@v2
node-version: 20.9.0
- uses: actions/checkout@v4
- name: Install
run: npm install --ignore-scripts
- name: Lint
run: npm run lint
- name: Lint Types
run: npm run dtslint
run: npm run tsd
233 changes: 5 additions & 228 deletions .github/workflows/prebuild.yaml
Original file line number Diff line number Diff line change
@@ -1,236 +1,13 @@
# Triggering prebuilds:
# 1. Create a draft release manually using the GitHub UI.
# 2. Set the `jobs.*.strategy.matrix.node` arrays to the set of Node.js versions
# to build for.
# 3. Set the `jobs.*.strategy.matrix.canvas_tag` arrays to the set of Canvas
# tags to build. (Usually this is a single tag, but can be an array when a
# new version of Node.js is released and older versions of Canvas need to be
# built.)
# 4. Commit and push this file to master.
# 5. In the Actions tab, navigate to the "Make Prebuilds" workflow and click
# "Run workflow".
# 6. Once the builds succeed, promote the draft release to a full release.
# This is a dummy file so that this workflow shows up in the Actions tab.
# Prebuilds are actually run using the prebuilds branch.

name: Make Prebuilds
on: workflow_dispatch

# UPLOAD_TO can be specified to upload the release assets under a different tag
# name (e.g. for testing). If omitted, the assets are published under the same
# release tag as the canvas version being built.
# env:
# UPLOAD_TO: "v0.0.1"

jobs:
Linux:
strategy:
matrix:
node: [8, 9, 10, 11, 12, 13, 14]
canvas_tag: [] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Linux
name: Nothing
runs-on: ubuntu-latest
container:
image: chearon/canvas-prebuilt:7
env:
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.canvas_tag }}

- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Build
run: |
npm install -g node-gyp
npm install --ignore-scripts
. prebuild/Linux/preinstall.sh
cp prebuild/Linux/binding.gyp binding.gyp
node-gyp rebuild -j 2
. prebuild/Linux/bundle.sh

- name: Test binary
run: |
cd /root/harfbuzz-* && make uninstall
cd /root/cairo-* && make uninstall
cd /root/pango-* && make uninstall
cd /root/libpng-* && make uninstall
cd /root/libjpeg-* && make uninstall
cd /root/giflib-* && make uninstall
cd $GITHUB_WORKSPACE && npm test

- name: Make bundle
id: make_bundle
run: . prebuild/tarball.sh

- name: Upload
uses: actions/github-script@0.9.0
with:
script: |
const fs = require("fs");
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");

const releases = await github.repos.listReleases({owner, repo});
const release = releases.data.find(r => r.tag_name === tagName);
if (!release)
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);

const oldAsset = release.assets.find(a => a.name === assetName);
if (oldAsset)
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});

// (This is equivalent to actions/upload-release-asset. We're
// already in a script, so might as well do it here.)
const r = await github.repos.uploadReleaseAsset({
url: release.upload_url,
headers: {
"content-type": "application/x-gzip",
"content-length": `${fs.statSync(assetName).size}`
},
name: assetName,
data: fs.readFileSync(assetName)
});

macOS:
strategy:
matrix:
node: [8, 9, 10, 11, 12, 13, 14]
canvas_tag: [] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS
runs-on: macos-latest
env:
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.canvas_tag }}

- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Build
run: |
npm install -g node-gyp
npm install --ignore-scripts
. prebuild/macOS/preinstall.sh
cp prebuild/macOS/binding.gyp binding.gyp
node-gyp rebuild -j 2
. prebuild/macOS/bundle.sh

- name: Test binary
run: |
brew uninstall --force cairo pango librsvg giflib harfbuzz
npm test

- name: Make bundle
id: make_bundle
run: . prebuild/tarball.sh

- name: Upload
uses: actions/github-script@0.9.0
with:
script: |
const fs = require("fs");
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");

const releases = await github.repos.listReleases({owner, repo});
const release = releases.data.find(r => r.tag_name === tagName);
if (!release)
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);

const oldAsset = release.assets.find(a => a.name === assetName);
if (oldAsset)
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});

// (This is equivalent to actions/upload-release-asset. We're
// already in a script, so might as well do it here.)
const r = await github.repos.uploadReleaseAsset({
url: release.upload_url,
headers: {
"content-type": "application/x-gzip",
"content-length": `${fs.statSync(assetName).size}`
},
name: assetName,
data: fs.readFileSync(assetName)
});

Win:
strategy:
matrix:
node: [8, 9, 10, 11, 12, 13, 14]
canvas_tag: [] # e.g. "v2.6.1"
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
runs-on: windows-latest
env:
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
steps:
# TODO drop when https://github.com/actions/virtual-environments/pull/632 lands
- uses: numworks/setup-msys2@v1
with:
update: true
path-type: inherit

- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- uses: actions/checkout@v2
with:
ref: ${{ matrix.canvas_tag }}

- name: Build
run: |
npm install -g node-gyp
npm install --ignore-scripts
msys2do . prebuild/Windows/preinstall.sh
msys2do cp prebuild/Windows/binding.gyp binding.gyp
msys2do node-gyp configure
msys2do node-gyp rebuild -j 2

- name: Bundle
run: msys2do . prebuild/Windows/bundle.sh

- name: Test binary
# By not running in msys2, this doesn't have access to the msys2 libs
run: npm test

- name: Make asset
id: make_bundle
# I can't figure out why this isn't an env var already. It shows up with `env`.
run: msys2do UPLOAD_TO=${{ env.UPLOAD_TO }} CANVAS_VERSION_TO_BUILD=${{ env.CANVAS_VERSION_TO_BUILD}} . prebuild/tarball.sh

- name: Upload
uses: actions/github-script@0.9.0
with:
script: |
const fs = require("fs");
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");

const releases = await github.repos.listReleases({owner, repo});
const release = releases.data.find(r => r.tag_name === tagName);
if (!release)
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);

const oldAsset = release.assets.find(a => a.name === assetName);
if (oldAsset)
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});

// (This is equivalent to actions/upload-release-asset. We're
// already in a script, so might as well do it here.)
const r = await github.repos.uploadReleaseAsset({
url: release.upload_url,
headers: {
"content-type": "application/x-gzip",
"content-length": `${fs.statSync(assetName).size}`
},
name: assetName,
data: fs.readFileSync(assetName)
});
- name: Nothing
run: echo "Nothing to do here"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build
test/images/*.png
examples/*.png
examples/*.jpg
examples/*.pdf
testing
out.png
out.pdf
Expand All @@ -16,3 +17,5 @@ package-lock.json
*.swp
*.un~
npm-debug.log

.idea
Loading