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.
@@ -2105,8 +2105,8 @@ var ColorMixin = {
2105
2105
  }
2106
2106
  const hex = parseInt(color.slice(1), 16);
2107
2107
  color = [hex >> 16, hex >> 8 & 0xff, hex & 0xff];
2108
- } else if (namedColors[color]) {
2109
- color = namedColors[color];
2108
+ } else if (namedColors[color.toLowerCase()]) {
2109
+ color = namedColors[color.toLowerCase()];
2110
2110
  } else if (this.spotColors[color]) {
2111
2111
  return this.spotColors[color];
2112
2112
  }
@@ -4518,7 +4518,9 @@ var TextMixin = {
4518
4518
  }
4519
4519
  dy = dy / 1000 * this._fontSize;
4520
4520
  }
4521
- const renderedWidth = options.textWidth + wordSpacing * (options.wordCount - 1) + characterSpacing * (text.length - 1);
4521
+ const measuredWidth = options.textWidth ?? this.widthOfString(text, options) - characterSpacing * (text.length - 1);
4522
+ const measuredWordCount = options.wordCount ?? (text.trim() ? text.trim().split(/\s+/).length : 0);
4523
+ const renderedWidth = measuredWidth + wordSpacing * (measuredWordCount - 1) + characterSpacing * (text.length - 1);
4522
4524
  if (options.link != null) {
4523
4525
  const linkOptions = {};
4524
4526
  if (this._currentStructureElement && this._currentStructureElement.dictionary.data.S === 'Link') {
@@ -6128,7 +6130,11 @@ var AttachmentsMixin = {
6128
6130
  }
6129
6131
  };
6130
6132
  function isEqual(a, b) {
6131
- 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());
6133
+ 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);
6134
+ }
6135
+ function isSameDate(a, b) {
6136
+ if (a === undefined || b === undefined) return a === b;
6137
+ return a.getTime() === b.getTime();
6132
6138
  }
6133
6139
 
6134
6140
  const ICC_PROFILE_PATH = new URL('./data/sRGB_IEC61966_2_1.icc', import.meta.url).href;