Skip to content

Commit 03519ac

Browse files
committed
0.1.62
1 parent 8cf3cdc commit 03519ac

File tree

5 files changed

+34
-25
lines changed

5 files changed

+34
-25
lines changed

build/pdfmake.js

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! pdfmake v0.1.61, @license MIT, @link http://pdfmake.org */
1+
/*! pdfmake v0.1.62, @license MIT, @link http://pdfmake.org */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -19434,18 +19434,6 @@ var findFont = function (fonts, requiredFonts, defaultFont) {
1943419434
return defaultFont;
1943519435
};
1943619436

19437-
var typeName = function (bold, italics) {
19438-
var type = 'normal';
19439-
if (bold && italics) {
19440-
type = 'bolditalics';
19441-
} else if (bold) {
19442-
type = 'bold';
19443-
} else if (italics) {
19444-
type = 'italics';
19445-
}
19446-
return type;
19447-
};
19448-
1944919437
////////////////////////////////////////
1945019438
// PdfPrinter
1945119439

@@ -20025,9 +20013,15 @@ function renderSVG(svg, x, y, pdfKitDoc, fontProvider) {
2002520013
fontOptions.fauxItalic = italic;
2002620014

2002720015
var fontsFamily = family.split(',').map(function (f) { return f.trim().replace(/('|")/g, ''); });
20028-
var font = findFont(fontProvider.fonts, fontsFamily, 'Roboto'); // TODO: default font from dd
20016+
var font = findFont(fontProvider.fonts, fontsFamily, svg.font || 'Roboto');
2002920017

20030-
return fontProvider.fonts[font][typeName(bold, italic)];
20018+
var fontFile = fontProvider.getFontFile(font, bold, italic);
20019+
if (fontFile === null) {
20020+
var type = fontProvider.getFontType(bold, italic);
20021+
throw new Error('Font \'' + font + '\' in style \'' + type + '\' is not defined in the font section of the document definition.');
20022+
}
20023+
20024+
return fontFile;
2003120025
};
2003220026

2003320027
getSvgToPDF()(pdfKitDoc, svg.svg, svg.x, svg.y, options);
@@ -59971,9 +59965,22 @@ function FontProvider(fontDescriptors, pdfKitDoc) {
5997159965
}
5997259966
}
5997359967

59974-
FontProvider.prototype.provideFont = function (familyName, bold, italics) {
59975-
var type = typeName(bold, italics);
59968+
FontProvider.prototype.getFontType = function (bold, italics) {
59969+
return typeName(bold, italics);
59970+
}
59971+
59972+
FontProvider.prototype.getFontFile = function (familyName, bold, italics) {
59973+
var type = this.getFontType(bold, italics);
5997659974
if (!this.fonts[familyName] || !this.fonts[familyName][type]) {
59975+
return null;
59976+
}
59977+
59978+
return this.fonts[familyName][type];
59979+
}
59980+
59981+
FontProvider.prototype.provideFont = function (familyName, bold, italics) {
59982+
var type = this.getFontType(bold, italics);
59983+
if (this.getFontFile(familyName, bold, italics) === null) {
5997759984
throw new Error('Font \'' + familyName + '\' in style \'' + type + '\' is not defined in the font section of the document definition.');
5997859985
}
5997959986

@@ -61271,6 +61278,8 @@ DocMeasure.prototype.measureSVG = function (node) {
6127161278

6127261279
this.measureImageWithDimensions(node, dimensions);
6127361280

61281+
node.font = this.styleStack.getProperty('font');
61282+
6127461283
// scale SVG based on final dimension
6127561284
node.svg = this.svgMeasure.writeDimensions(node.svg, {
6127661285
width: node._width,

build/pdfmake.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdfmake.min.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdfmake.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pdfmake",
3-
"version": "0.1.61",
3+
"version": "0.1.62",
44
"description": "Client/server side PDF printing in pure JavaScript",
55
"main": "src/printer.js",
66
"browser": "build/pdfmake.js",

0 commit comments

Comments
 (0)