pdfkit 0.20.1 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/js/pdfkit.browser.js +10 -4
- package/js/pdfkit.browser.js.map +1 -1
- package/js/pdfkit.browser.mjs +10 -4
- package/js/pdfkit.browser.mjs.map +1 -1
- package/js/pdfkit.js +10 -4
- package/js/pdfkit.js.map +1 -1
- package/js/pdfkit.node.mjs +10 -4
- package/js/pdfkit.node.mjs.map +1 -1
- package/package.json +2 -5
package/js/pdfkit.js
CHANGED
|
@@ -2110,8 +2110,8 @@ var ColorMixin = {
|
|
|
2110
2110
|
}
|
|
2111
2111
|
const hex = parseInt(color.slice(1), 16);
|
|
2112
2112
|
color = [hex >> 16, hex >> 8 & 0xff, hex & 0xff];
|
|
2113
|
-
} else if (namedColors[color]) {
|
|
2114
|
-
color = namedColors[color];
|
|
2113
|
+
} else if (namedColors[color.toLowerCase()]) {
|
|
2114
|
+
color = namedColors[color.toLowerCase()];
|
|
2115
2115
|
} else if (this.spotColors[color]) {
|
|
2116
2116
|
return this.spotColors[color];
|
|
2117
2117
|
}
|
|
@@ -4523,7 +4523,9 @@ var TextMixin = {
|
|
|
4523
4523
|
}
|
|
4524
4524
|
dy = dy / 1000 * this._fontSize;
|
|
4525
4525
|
}
|
|
4526
|
-
const
|
|
4526
|
+
const measuredWidth = options.textWidth ?? this.widthOfString(text, options) - characterSpacing * (text.length - 1);
|
|
4527
|
+
const measuredWordCount = options.wordCount ?? (text.trim() ? text.trim().split(/\s+/).length : 0);
|
|
4528
|
+
const renderedWidth = measuredWidth + wordSpacing * (measuredWordCount - 1) + characterSpacing * (text.length - 1);
|
|
4527
4529
|
if (options.link != null) {
|
|
4528
4530
|
const linkOptions = {};
|
|
4529
4531
|
if (this._currentStructureElement && this._currentStructureElement.dictionary.data.S === 'Link') {
|
|
@@ -6133,7 +6135,11 @@ var AttachmentsMixin = {
|
|
|
6133
6135
|
}
|
|
6134
6136
|
};
|
|
6135
6137
|
function isEqual(a, b) {
|
|
6136
|
-
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate
|
|
6138
|
+
return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && isSameDate(a.Params.CreationDate, b.Params.CreationDate) && isSameDate(a.Params.ModDate, b.Params.ModDate);
|
|
6139
|
+
}
|
|
6140
|
+
function isSameDate(a, b) {
|
|
6141
|
+
if (a === undefined || b === undefined) return a === b;
|
|
6142
|
+
return a.getTime() === b.getTime();
|
|
6137
6143
|
}
|
|
6138
6144
|
|
|
6139
6145
|
const ICC_PROFILE_PATH = new URL('./data/sRGB_IEC61966_2_1.icc', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('pdfkit.js', document.baseURI).href))).href;
|