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.
@@ -2217,8 +2217,8 @@ var ColorMixin = {
2217
2217
  }
2218
2218
  const hex = parseInt(color.slice(1), 16);
2219
2219
  color = [hex >> 16, hex >> 8 & 0xff, hex & 0xff];
2220
- } else if (namedColors[color]) {
2221
- color = namedColors[color];
2220
+ } else if (namedColors[color.toLowerCase()]) {
2221
+ color = namedColors[color.toLowerCase()];
2222
2222
  } else if (this.spotColors[color]) {
2223
2223
  return this.spotColors[color];
2224
2224
  }
@@ -4599,7 +4599,9 @@ var TextMixin = {
4599
4599
  }
4600
4600
  dy = dy / 1000 * this._fontSize;
4601
4601
  }
4602
- const renderedWidth = options.textWidth + wordSpacing * (options.wordCount - 1) + characterSpacing * (text.length - 1);
4602
+ const measuredWidth = options.textWidth ?? this.widthOfString(text, options) - characterSpacing * (text.length - 1);
4603
+ const measuredWordCount = options.wordCount ?? (text.trim() ? text.trim().split(/\s+/).length : 0);
4604
+ const renderedWidth = measuredWidth + wordSpacing * (measuredWordCount - 1) + characterSpacing * (text.length - 1);
4603
4605
  if (options.link != null) {
4604
4606
  const linkOptions = {};
4605
4607
  if (this._currentStructureElement && this._currentStructureElement.dictionary.data.S === 'Link') {
@@ -6209,7 +6211,11 @@ var AttachmentsMixin = {
6209
6211
  }
6210
6212
  };
6211
6213
  function isEqual(a, b) {
6212
- return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate.getTime() === b.Params.CreationDate.getTime() && (a.Params.ModDate === undefined && b.Params.ModDate === undefined || a.Params.ModDate.getTime() === b.Params.ModDate.getTime());
6214
+ 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);
6215
+ }
6216
+ function isSameDate(a, b) {
6217
+ if (a === undefined || b === undefined) return a === b;
6218
+ return a.getTime() === b.getTime();
6213
6219
  }
6214
6220
 
6215
6221
  const ICC_PROFILE_PATH = new URL('./data/sRGB_IEC61966_2_1.icc', import.meta.url).href;