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
Unless previously installed you'll _need___Cairo__. For system-specific installation view the [Wiki](https://github.com/Automattic/node-canvas/wiki/_pages).
30
+
Unless previously installed you'll _need___Cairo__ and __Pango__. For system-specific installation view the [Wiki](https://github.com/Automattic/node-canvas/wiki/_pages).
31
+
32
+
Currently the minimum version of node required is __0.10.0__
23
33
24
34
You can quickly install the dependencies by using the command for your OS:
25
35
26
36
OS | Command
27
37
----- | -----
28
-
OS X | `brew install pkg-config cairo libpng jpeg giflib`
38
+
OS X | `brew install pkg-config cairo pango libpng jpeg giflib`
Windows | [Instructions on our wiki](https://github.com/Automattic/node-canvas/wiki/Installation---Windows)
33
43
34
44
**El Capitan users:** If you have recently updated to El Capitan and are experiencing trouble when compiling, run the following command: `xcode-select --install`. Read more about the problem [on Stack Overflow](http://stackoverflow.com/a/32929012/148072).
@@ -140,10 +150,22 @@ var stream = canvas.jpegStream({
140
150
141
151
### Canvas#toBuffer()
142
152
143
-
A call to `Canvas#toBuffer()` will return a node `Buffer` instance containing all of the PNG data.
153
+
A call to `Canvas#toBuffer()` will return a node `Buffer` instance containing image data.
canvas.toDataURL('image/jpeg', quality, function(err, jpeg){ }); // spec-following; quality from 0 to 1
171
193
```
172
194
195
+
### Canvas.registerFont for bundled fonts
196
+
197
+
It can be useful to use a custom font file if you are distributing code that uses node-canvas and a specific font. Or perhaps you are using it to do automated tests and you want the renderings to be the same across operating systems regardless of what fonts are installed.
198
+
199
+
To do that, you should use `Canvas.registerFont`.
200
+
201
+
**You need to call it before the Canvas is created**
ctx.fillText(250, 10, 'Everyone hates this font :(');
211
+
```
212
+
213
+
The second argument is an object with properties that resemble the CSS properties that are specified in `@font-face` rules. You must specify at least `family`. `weight`, and `style` are optional (and default to "normal").
214
+
173
215
### CanvasRenderingContext2D#patternQuality
174
216
175
217
Given one of the values below will alter pattern (gradients, images, etc) render quality, defaults to _good_.
@@ -298,16 +340,6 @@ Visual tests:
298
340
299
341
$ make test-server
300
342
301
-
## Versions
302
-
303
-
Tested with and designed for:
304
-
305
-
- node 0.4.2
306
-
- cairo 1.8.6
307
-
308
-
For node 0.2.x `node-canvas` <= 0.4.3 may be used,
0 commit comments