You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 906da87
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ Upgrading from 3.x? Upgrade to the latest 3.x release first, fix the deprecation
137
137
### Fixes
138
138
139
139
-`renderSVG()` bounds the points paths are made of: an arc between far-apart ends is drawn with at most 64 curves a turn (a 139-byte path, `M 1e25 100 A 40 30 20 1 1 160 100`, stroked, ran the process out of memory), and the curves of arcs and the points of all paths, also of each copy drawn through `<use>`, count against 2^25 points plus 4 per pixel of the output in one render and 2^21 in one path. Reading path data and placing text along a `<textPath>` count, too, and SVGs embedded as images share the budget of the render they are in. More throw a `LimitError` (which a text's layout no longer takes for a damaged font). A path drawn through `<use>` is read once a render instead of once a copy.
140
-
- SVG text: the glyph outlines of all texts count against the render's points before they are made, 16 points a command (20 texts of 1,000 characters of a complex font ran the process out of memory), so very long texts need a larger output; many `<tspan>`s in one `<text>` take linear time (10,000 took 20 s); a `<textPath>` on a long path renders at a normal size; bitmap emoji (CBDT, sbix) are decoded once a render instead of once a draw (copies through `<use>` took minutes), at most 2048x2048 pixels each (larger ones aren't drawn, also in `renderText()`: one that said 16383x16383 ran the process out of memory), and counted before they are decoded, also damaged ones. `renderText()` counts the work of decoding and scaling its bitmap glyphs against 2^28 pixels plus 64 per pixel of the image (more throw a `LimitError`), keeps at most 2^22 pixels of scaled glyphs in a render and none after it (they were kept with the font: 1 GB a size), keeps rasters of outline and color glyphs with the font only up to 256 KB each, 16 MB a font and 8 text colors a glyph (62 letters at size 6000 kept 774 MB, a new color each render grew without end), and doesn't draw a glyph scaled to more than 4 times the image (a strike at ppem 1 made a 32768x32768 copy for a 10x10 image).
140
+
- SVG text: the glyph outlines of all texts count against the render's points before they are made, 16 points a command (20 texts of 1,000 characters of a complex font ran the process out of memory), so very long texts need a larger output; many `<tspan>`s in one `<text>` take linear time (10,000 took 20 s); a `<textPath>` on a long path renders at a normal size; bitmap emoji (CBDT, sbix) are decoded once a render instead of once a draw (copies through `<use>` took minutes), at most 2048x2048 pixels each (larger ones aren't drawn, also in `renderText()`: one that said 16383x16383 ran the process out of memory), and counted before they are decoded, also damaged ones. `renderText()` counts the work of decoding and scaling its bitmap glyphs against 2^28 pixels plus 64 per pixel of the image (more throw a `LimitError`), keeps at most 2^22 pixels of scaled glyphs in a render and none after it (they were kept with the font: 1 GB a size), keeps rasters of outline and color glyphs with the font only up to 256 KB each, 16 MB a font and 8 text colors a glyph (62 letters at size 6000 kept 774 MB, a new color each render grew without end), counts the glyphs it rasterizes against the same work budget as bitmap glyphs (2000 huge glyphs without advance took 260 s), frees a size's rasters when its sizes are evicted, and keeps at most 16 instances of a variable font (a new weight each render ran out of memory after 8000), and doesn't draw a glyph scaled to more than 4 times the image (a strike at ppem 1 made a 32768x32768 copy for a 10x10 image).
141
141
-`renderText()` takes linear time for many combining marks and lines (400,000 lines took minutes).
142
142
- Very long text (50,000 characters in SVG, 200,000 combining marks or lines in `renderText()`) no longer overflows the call stack or says the font is damaged.
143
143
- Binary data and dates of other realms (iframes, `node:vm`, Jest) are accepted; objects that only claim to be one by `Symbol.toStringTag` aren't, and a detached buffer throws a `TypeError` that says so.
thrownewLimitError('Text too complex: its glyphs take more work to decode, scale and rasterize than an image of this size allows (2^28 pixels and 64 per pixel of the image)');
563
+
}
564
+
552
565
// a bitmap glyph's PNG decoded and scaled from its strike to the font size, premultiplied
if((budget.left-=pixels)<0)thrownewLimitError('Text too complex: its bitmap glyphs take more pixels to decode and scale than an image of this size allows (2^28 and 64 per pixel)');
556
-
};
557
567
// (decoding takes about the time of 4 pixels a pixel, counted before it, as damaged ones take it too)
if(collect&&process.memoryUsage().heapUsed-heap>128*2**20)panic(`a variable font at 400 weights: kept ${(process.memoryUsage().heapUsed-heap)>>20} MB of heap`);
0 commit comments