abstract-document 11.1.2 → 11.2.0
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/lib/abstract-document-exporters/pdf/render-image.js +139 -12
- package/lib/abstract-document-exporters/pdf/render-image.js.map +1 -1
- package/package.json +3 -3
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Group.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Header and footer.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Header → footer.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink and textrun.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink → textrun.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun and images.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun → images.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple images.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple tables.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Center alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with End alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Page numbering.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan and rowSpan.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan → rowSpan.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table without rows.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single hyperlink.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single image.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment that linebreaks.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/hello with Arial font.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/hello.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/letter-dimensions.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/page-orientation-landscape.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/page-orientation-portrait.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/tocSeparator.docx +0 -0
- package/src/abstract-document-exporters/__tests__/docx2/tmp/world.docx +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position group.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position header and footer.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position paragraph.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in group.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in table.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position table.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Paragraphs.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Tables.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group no keeptogether.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Group too big for one page.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Header and footer.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal linktarget.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Manual line break.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Manual line breaks empty lines.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Margins header body footer.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun no underline.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun with underline.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun and images.pdf and b/package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun → images.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images overflow.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Center alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with End alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Page numbering.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table row that doesnt fit page.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table single row.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with group.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header 2.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin bottom.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top single table.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan multipages.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all auto.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all fix.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table background.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of image.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of text.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table center alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table colSpan and rowSpan.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table minimal row height.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table mix auto fix.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table padding.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table right alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table row alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell with wrapping.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with default colored borders.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with header.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with multi colored borders.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with single colored borders.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single date.pdf +14 -14
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single figure.pdf +15 -13
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink centered.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink no underline.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink right aligned.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image from URL.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color hex.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color name.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color url.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg dasharray.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image.pdf +0 -0
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline alphabetic.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline bottom.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline hanging.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline middle.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline top.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Justify alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment that linebreaks.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with super and subscripts.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/Table of content separator.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/hello with roman font.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/hello.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/pagebreak.pdf +2 -2
- package/src/abstract-document-exporters/__tests__/pdf/tmp/world.pdf +2 -2
- package/src/abstract-document-exporters/pdf/render-image.ts +142 -12
|
@@ -122,8 +122,9 @@ function abstractComponentToPdf(
|
|
|
122
122
|
.lineWidth(component.strokeThickness)
|
|
123
123
|
.moveTo(component.start.x, component.start.y)
|
|
124
124
|
.lineTo(component.end.x, component.end.y)
|
|
125
|
-
.strokeOpacity(colorToOpacity(component.strokeColor))
|
|
126
|
-
|
|
125
|
+
.strokeOpacity(colorToOpacity(component.strokeColor));
|
|
126
|
+
applyStrokeDashStyle(pdf, component.strokeDashStyle);
|
|
127
|
+
pdf.stroke(colorToRgb(component.strokeColor));
|
|
127
128
|
break;
|
|
128
129
|
case "polyline":
|
|
129
130
|
for (let i = 0; i < component.points.length; ++i) {
|
|
@@ -134,10 +135,9 @@ function abstractComponentToPdf(
|
|
|
134
135
|
pdf.lineTo(p.x, p.y);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
pdf
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.stroke(colorToRgb(component.strokeColor));
|
|
138
|
+
pdf.lineWidth(component.strokeThickness).strokeOpacity(colorToOpacity(component.strokeColor));
|
|
139
|
+
applyStrokeDashStyle(pdf, component.strokeDashStyle);
|
|
140
|
+
pdf.stroke(colorToRgb(component.strokeColor));
|
|
141
141
|
break;
|
|
142
142
|
case "text":
|
|
143
143
|
const font = getFontName(component.fontFamily, component.fontWeight, component.italic);
|
|
@@ -180,16 +180,18 @@ function abstractComponentToPdf(
|
|
|
180
180
|
.lineWidth(component.strokeThickness)
|
|
181
181
|
.ellipse(centerX, centerY, width * 0.5, height * 0.5)
|
|
182
182
|
.strokeOpacity(colorToOpacity(component.strokeColor))
|
|
183
|
-
.fillOpacity(colorToOpacity(component.fillColor))
|
|
184
|
-
|
|
183
|
+
.fillOpacity(colorToOpacity(component.fillColor));
|
|
184
|
+
applyStrokeDashStyle(pdf, component.strokeDashStyle);
|
|
185
|
+
pdf.fillAndStroke(colorToRgb(component.fillColor), colorToRgb(component.strokeColor));
|
|
185
186
|
break;
|
|
186
187
|
case "polygon":
|
|
187
188
|
pdf
|
|
188
189
|
.lineWidth(component.strokeThickness)
|
|
189
190
|
.strokeOpacity(colorToOpacity(component.strokeColor))
|
|
190
191
|
.fillOpacity(colorToOpacity(component.fillColor))
|
|
191
|
-
.polygon(...component.points.map((p) => [p.x, p.y]))
|
|
192
|
-
|
|
192
|
+
.polygon(...component.points.map((p) => [p.x, p.y]));
|
|
193
|
+
applyStrokeDashStyle(pdf, component.strokeDashStyle);
|
|
194
|
+
pdf.fillAndStroke(colorToRgb(component.fillColor), colorToRgb(component.strokeColor));
|
|
193
195
|
break;
|
|
194
196
|
case "rectangle":
|
|
195
197
|
const rWidth = component.bottomRight.x - component.topLeft.x;
|
|
@@ -198,8 +200,9 @@ function abstractComponentToPdf(
|
|
|
198
200
|
.lineWidth(component.strokeThickness)
|
|
199
201
|
.strokeOpacity(colorToOpacity(component.strokeColor))
|
|
200
202
|
.fillOpacity(colorToOpacity(component.fillColor))
|
|
201
|
-
.rect(component.topLeft.x, component.topLeft.y, rWidth, rHeight)
|
|
202
|
-
|
|
203
|
+
.rect(component.topLeft.x, component.topLeft.y, rWidth, rHeight);
|
|
204
|
+
applyStrokeDashStyle(pdf, component.strokeDashStyle);
|
|
205
|
+
pdf.fillAndStroke(colorToRgb(component.fillColor), colorToRgb(component.strokeColor));
|
|
203
206
|
break;
|
|
204
207
|
default:
|
|
205
208
|
break;
|
|
@@ -213,3 +216,130 @@ function colorToOpacity(color: AbstractImage.Color): number {
|
|
|
213
216
|
function colorToRgb(color: AbstractImage.Color): [number, number, number] {
|
|
214
217
|
return [color.r, color.g, color.b];
|
|
215
218
|
}
|
|
219
|
+
|
|
220
|
+
function applyStrokeDashStyle(pdf: PDFKit.PDFDocument, dashStyle: AbstractImage.DashStyle): void {
|
|
221
|
+
if (dashStyle.dashes.length === 0) {
|
|
222
|
+
pdf.undash();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
let dashes = [...dashStyle.dashes];
|
|
227
|
+
let phase = dashStyle.offset;
|
|
228
|
+
|
|
229
|
+
// Anytime there's a 0 that isn't the first or last element of the array,
|
|
230
|
+
// we can remove it by combining the previous or next value. If it's a
|
|
231
|
+
// dash, then it's a zero-length dash between two spaces, so the dash can
|
|
232
|
+
// be eliminated and spaces combined by summing them, replacing all three
|
|
233
|
+
// values with the sum of the two spaces. If the 0 value is a space, then
|
|
234
|
+
// it's a zero-length space between two dashes, and the dashes can be
|
|
235
|
+
// similarly combined. So first we run that logic iteratively to remove
|
|
236
|
+
// all the 0s from the dash array that aren't the first or last element.
|
|
237
|
+
// Note that because we replace 3 values with one value, this doesn't
|
|
238
|
+
// change the even-ness of the length of dashArray.
|
|
239
|
+
for (;;) {
|
|
240
|
+
const index = dashes.slice(1, -1).indexOf(0);
|
|
241
|
+
if (index === -1) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
const actualIndex = index + 1;
|
|
245
|
+
const replacementValue = dashes[actualIndex - 1] + dashes[actualIndex + 1];
|
|
246
|
+
dashes = dashes
|
|
247
|
+
.slice(0, actualIndex - 1)
|
|
248
|
+
.concat([replacementValue])
|
|
249
|
+
.concat(dashes.slice(actualIndex + 2));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// The stroke array only having two elements (a dash value and space
|
|
253
|
+
// value) is a special case.
|
|
254
|
+
if (dashes.length === 1) {
|
|
255
|
+
dashes = [dashes[0], dashes[0]];
|
|
256
|
+
if (dashes[0] === 0) {
|
|
257
|
+
pdf.strokeOpacity(0);
|
|
258
|
+
}
|
|
259
|
+
} else if (dashes.length === 2) {
|
|
260
|
+
if (dashes[0] === 0) {
|
|
261
|
+
// Regardless of the space value, the dash length is zero, so we're
|
|
262
|
+
// not actually drawing a stroke. We can't describe that in a
|
|
263
|
+
// doc.dash() call in a way that PDFKit will accept, so we set the
|
|
264
|
+
// stroke opacity to zero as our best approximation.
|
|
265
|
+
pdf.strokeOpacity(0);
|
|
266
|
+
return;
|
|
267
|
+
} else if (dashes[1] === 0) {
|
|
268
|
+
// Regardless of the dash value, the space value is zero, meaning
|
|
269
|
+
// we're actually drawing a solid stroke, not a dashed one. We can
|
|
270
|
+
// make this happen by just emptying out the dash array.
|
|
271
|
+
dashes = [];
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
if (dashes[0] === 0) {
|
|
275
|
+
// The first dash is zero-length. We fix this by combining the first
|
|
276
|
+
// space (just after the first dash) with the last space and updating
|
|
277
|
+
// the dash offset accordingly. For example, if we had
|
|
278
|
+
//
|
|
279
|
+
// [ 0 4 3 2 5 1 ] (dash offset 0)
|
|
280
|
+
//
|
|
281
|
+
// ␣␣␣␣---␣␣-----␣
|
|
282
|
+
// ⎸
|
|
283
|
+
//
|
|
284
|
+
// we'd end up with
|
|
285
|
+
//
|
|
286
|
+
// [ 3 2 5 5 ] (dash offset -4)
|
|
287
|
+
//
|
|
288
|
+
// ---␣␣-----␣␣␣␣␣
|
|
289
|
+
// ⎸
|
|
290
|
+
//
|
|
291
|
+
// Another example where the dash array also ends with a 0:
|
|
292
|
+
//
|
|
293
|
+
// [ 0 4 3 2 5 0 ] (dash offset 0)
|
|
294
|
+
//
|
|
295
|
+
// ␣␣␣␣---␣␣-----
|
|
296
|
+
// ⎸
|
|
297
|
+
//
|
|
298
|
+
// we'd end up with
|
|
299
|
+
//
|
|
300
|
+
// [ 3 2 5 4 ] (dash offset -4)
|
|
301
|
+
//
|
|
302
|
+
// ---␣␣-----␣␣␣␣
|
|
303
|
+
// ⎸
|
|
304
|
+
phase -= dashes[1];
|
|
305
|
+
dashes[dashes.length - 1] += dashes[1];
|
|
306
|
+
dashes = dashes.slice(2);
|
|
307
|
+
}
|
|
308
|
+
if (dashes[dashes.length - 1] === 0) {
|
|
309
|
+
// The last space is zero-length. We fix this by combining the last dash
|
|
310
|
+
// (just before the last space) with the first dash and updating the
|
|
311
|
+
// dash offset accordingly. For example, if we had
|
|
312
|
+
//
|
|
313
|
+
// [ 1 4 3 2 5 0 ] (dash offset 0)
|
|
314
|
+
//
|
|
315
|
+
// -␣␣␣␣---␣␣-----
|
|
316
|
+
// ⎸
|
|
317
|
+
//
|
|
318
|
+
// we'd end up with
|
|
319
|
+
//
|
|
320
|
+
// [ 6 4 3 2 ] (dash offset 5)
|
|
321
|
+
//
|
|
322
|
+
// ------␣␣␣␣---␣␣
|
|
323
|
+
// ⎸
|
|
324
|
+
//
|
|
325
|
+
phase += dashes[dashes.length - 2];
|
|
326
|
+
dashes[0] += dashes[dashes.length - 2];
|
|
327
|
+
dashes = dashes.slice(0, -2);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Ensure the dash offset is non-negative (because of crbug.com/660850).
|
|
332
|
+
// First compute the total length of the dash array so we can add it to
|
|
333
|
+
// dash offset until dash offset is non-negative.
|
|
334
|
+
let length = 0;
|
|
335
|
+
for (const dash of dashes) {
|
|
336
|
+
length += dash;
|
|
337
|
+
}
|
|
338
|
+
if (length > 0) {
|
|
339
|
+
while (phase < 0) {
|
|
340
|
+
phase += length;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
(pdf as { dash: (length: number | ReadonlyArray<number>, option: any) => any }).dash(dashes, { phase: phase });
|
|
345
|
+
}
|