|
50 | 50 | * @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url
|
51 | 51 | * @return {Promise} - A promise that is fulfilled with a SVG image data URL
|
52 | 52 | * */
|
53 |
| - function toSvg(node, options) { |
| 53 | + function toSvg(node, options, loadfonts) { |
54 | 54 | options = options || {};
|
55 | 55 | copyOptions(options);
|
56 | 56 | return Promise.resolve(node)
|
57 | 57 | .then(function (node) {
|
58 | 58 | return cloneNode(node, options.filter, true);
|
59 | 59 | })
|
60 |
| - .then(embedFonts) |
| 60 | + .then(loadfonts && embedFonts) |
61 | 61 | .then(inlineImages)
|
62 | 62 | .then(applyOptions)
|
63 | 63 | .then(function (clone) {
|
|
104 | 104 | * @param {Object} options - Rendering options, @see {@link toSvg}
|
105 | 105 | * @return {Promise} - A promise that is fulfilled with a PNG image data URL
|
106 | 106 | * */
|
107 |
| - function toPng(node, options) { |
108 |
| - return draw(node, options || {}) |
| 107 | + function toPng(node, options, loadfonts) { |
| 108 | + return draw(node, options || {}, loadfonts || true) |
109 | 109 | .then(function (canvas) {
|
110 | 110 | return canvas.toDataURL();
|
111 | 111 | });
|
|
149 | 149 | }
|
150 | 150 | }
|
151 | 151 |
|
152 |
| - function draw(domNode, options) { |
153 |
| - return toSvg(domNode, options) |
| 152 | + function draw(domNode, options, loadfonts) { |
| 153 | + return toSvg(domNode, options, loadfonts) |
154 | 154 | .then(util.makeImage)
|
155 | 155 | .then(util.delay(100))
|
156 | 156 | .then(function (image) {
|
|
0 commit comments