@quillmark/quillify 0.0.0-stage → 0.3.1

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.
Files changed (59) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +85 -0
  3. package/README.md +56 -2
  4. package/assets/LiberationSans-Bold.ttf +0 -0
  5. package/assets/LiberationSans-BoldItalic.ttf +0 -0
  6. package/assets/LiberationSans-Italic.ttf +0 -0
  7. package/assets/LiberationSans-Regular.ttf +0 -0
  8. package/assets/pdf.worker.js +64908 -0
  9. package/assets/qpdf.wasm +0 -0
  10. package/assets/qpdf.worker.js +155 -0
  11. package/assets/xfa-layer.d.ts +2 -0
  12. package/assets/xfa-layer.js +1 -0
  13. package/dist/api.d.ts +83 -0
  14. package/dist/api.js +1 -0
  15. package/dist/assemble.d.ts +21 -0
  16. package/dist/assemble.js +155 -0
  17. package/dist/coords.d.ts +7 -0
  18. package/dist/coords.js +28 -0
  19. package/dist/display-list.d.ts +87 -0
  20. package/dist/display-list.js +372 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.js +4 -0
  23. package/dist/inventory.d.ts +4 -0
  24. package/dist/inventory.js +179 -0
  25. package/dist/naming.d.ts +3 -0
  26. package/dist/naming.js +116 -0
  27. package/dist/normalize.d.ts +39 -0
  28. package/dist/normalize.js +303 -0
  29. package/dist/pdfjs.d.ts +17 -0
  30. package/dist/pdfjs.js +96 -0
  31. package/dist/quillify.d.ts +13 -0
  32. package/dist/quillify.js +86 -0
  33. package/dist/refusal.d.ts +47 -0
  34. package/dist/refusal.js +8 -0
  35. package/dist/sanitize.d.ts +20 -0
  36. package/dist/sanitize.js +72 -0
  37. package/dist/strip.d.ts +82 -0
  38. package/dist/strip.js +533 -0
  39. package/dist/types.d.ts +125 -0
  40. package/dist/types.js +42 -0
  41. package/dist/xfa-layer.d.ts +40 -0
  42. package/dist/xfa-layer.js +143 -0
  43. package/dist/xfa-widgets.d.ts +36 -0
  44. package/dist/xfa-widgets.js +131 -0
  45. package/dist/xfa.d.ts +15 -0
  46. package/dist/xfa.js +371 -0
  47. package/licenses/LiberationSans-LICENSE +102 -0
  48. package/licenses/compiler-rt-LICENSE +311 -0
  49. package/licenses/emscripten-LICENSE +102 -0
  50. package/licenses/libcxx-LICENSE +311 -0
  51. package/licenses/libcxxabi-LICENSE +311 -0
  52. package/licenses/libjpeg-turbo-LICENSE +132 -0
  53. package/licenses/libjpeg-turbo-README.ijg +258 -0
  54. package/licenses/musl-COPYRIGHT +193 -0
  55. package/licenses/pdf.js-LICENSE +177 -0
  56. package/licenses/qpdf-LICENSE +202 -0
  57. package/licenses/qpdf-NOTICE +42 -0
  58. package/licenses/zlib-README +118 -0
  59. package/package.json +70 -5
package/dist/xfa.js ADDED
@@ -0,0 +1,371 @@
1
+ import { PDFAcroCheckBox, PDFAcroComboBox, PDFAcroRadioButton, PDFAcroText, PDFCheckBox, PDFDocument, PDFDropdown, PDFFont, PDFField, PDFHexString, PDFName, PDFOperator, PDFOperatorNames, PDFPage, PDFRadioGroup, PDFTextField, StandardFonts, degrees, rgb } from 'pdf-lib';
2
+ import { displayList } from './display-list.js';
3
+ import { openPdf } from './pdfjs.js';
4
+ import { Refused } from './refusal.js';
5
+ import { MAX_PAGES, MAX_PICTURE_PIXELS } from './types.js';
6
+ import { XfaStage } from './xfa-layer.js';
7
+ import { harvestWidgets } from './xfa-widgets.js';
8
+ /**
9
+ * A dynamic Adobe LiveCycle form as an ordinary static AcroForm, or the input
10
+ * unchanged when it is not one.
11
+ *
12
+ * In a dynamic form the fields exist only as XML inside `/AcroForm /XFA`:
13
+ * `/Fields` is empty, and the one page in the file is a placeholder, most often
14
+ * a "Please wait" notice. Converting one takes an XFA layout engine, and pdf.js
15
+ * has one. This runs it, reads the geometry the browser solved off the DOM, and
16
+ * writes both the printed page and the fields back out as a PDF the later
17
+ * stages already take.
18
+ *
19
+ * It is a normalization: bytes in, bytes out, and every later stage reads the
20
+ * result as it reads a static form.
21
+ */
22
+ export async function xfaToAcroForm(bytes, signal) {
23
+ const stage = new XfaStage();
24
+ let opened;
25
+ try {
26
+ // pdf.js adds the faces a form embeds to this document's font set.
27
+ opened = await openPdf(bytes, { enableXfa: true, ownerDocument: await stage.ready }, signal);
28
+ const { pdf, within } = opened;
29
+ if (!pdf.isPureXfa)
30
+ return bytes;
31
+ // pdf.js counts a dynamic form's pages as it opens the file.
32
+ if (pdf.numPages > MAX_PAGES)
33
+ throw new Refused({ code: 'too_many_pages', pages: pdf.numPages, limit: MAX_PAGES });
34
+ const out = await PDFDocument.create();
35
+ const fonts = new Map();
36
+ const widgets = [];
37
+ let pixels = 0;
38
+ for (let number = 1; number <= pdf.numPages; number++) {
39
+ const laid = await within(pdf.getPage(number).then((page) => stage.lay(page)));
40
+ // The shipped worker writes a span of one of these classes where the page's
41
+ // text embeds a page number or a page count that a layout script fills.
42
+ for (const span of laid.layer.querySelectorAll('.xfaPageNumber'))
43
+ span.textContent = String(number);
44
+ for (const span of laid.layer.querySelectorAll('.xfaPageCount'))
45
+ span.textContent = String(pdf.numPages);
46
+ const list = displayList(laid, number);
47
+ for (const item of list.drawn)
48
+ if ('image' in item)
49
+ pixels += item.image.naturalWidth * item.image.naturalHeight;
50
+ if (pixels > MAX_PICTURE_PIXELS)
51
+ throw new Refused({
52
+ code: 'unpaintable',
53
+ page: number - 1,
54
+ construct: 'image',
55
+ detail: 'pixels'
56
+ });
57
+ for (const widget of harvestWidgets(laid, number))
58
+ widgets.push(widget);
59
+ await paint(out.addPage([list.width, list.height]), number, list, async (name) => {
60
+ let font = fonts.get(name);
61
+ if (!font)
62
+ fonts.set(name, (font = await out.embedFont(name)));
63
+ return font;
64
+ });
65
+ }
66
+ stamp(out, widgets);
67
+ return await out.save();
68
+ }
69
+ finally {
70
+ stage.close();
71
+ await opened?.close();
72
+ }
73
+ }
74
+ /** PDF's origin is bottom-left; every primitive arrives top-left. */
75
+ async function paint(page, pageNumber, list, font) {
76
+ const H = list.height;
77
+ for (const item of list.drawn) {
78
+ if ('text' in item) {
79
+ await drawRun(page, pageNumber, item, H, font);
80
+ continue;
81
+ }
82
+ if ('image' in item) {
83
+ const { x, y, w, h, image } = item;
84
+ // The pixels are read off a canvas of the host page's. The frame's policy
85
+ // governs what its document loads, and the picture is of the page's origin.
86
+ const canvas = document.createElement('canvas');
87
+ canvas.width = image.naturalWidth;
88
+ canvas.height = image.naturalHeight;
89
+ canvas.getContext('2d').drawImage(image, 0, 0);
90
+ const png = canvas.toDataURL('image/png');
91
+ // What a canvas with a side the browser will not make gives.
92
+ if (png === 'data:,')
93
+ throw new Refused({ code: 'unpaintable', page: pageNumber - 1, construct: 'image' });
94
+ page.drawImage(await page.doc.embedPng(png), { x, y: H - y - h, width: w, height: h });
95
+ continue;
96
+ }
97
+ if ('x1' in item) {
98
+ page.drawLine({
99
+ start: { x: item.x1, y: H - item.y1 },
100
+ end: { x: item.x2, y: H - item.y2 },
101
+ thickness: item.width,
102
+ color: rgb(...item.colour)
103
+ });
104
+ continue;
105
+ }
106
+ let box = item;
107
+ if (box.radius) {
108
+ // An SVG rect's outline runs along the middle of its stroke, and each
109
+ // radius stops at half the side it lies along.
110
+ const [edge] = box.edges;
111
+ const inset = (edge?.width ?? 0) / 2;
112
+ const w = box.w - 2 * inset;
113
+ const h = box.h - 2 * inset;
114
+ const rx = Math.min(box.radius, w / 2);
115
+ const ry = Math.min(box.radius, h / 2);
116
+ const turn = `a ${rx},${ry} 0 0 1`;
117
+ page.drawSvgPath(`M ${rx},0 h ${w - 2 * rx} ${turn} ${rx},${ry} v ${h - 2 * ry} ${turn} ${-rx},${ry} h ${2 * rx - w} ${turn} ${-rx},${-ry} v ${2 * ry - h} ${turn} ${rx},${-ry} z`, {
118
+ x: box.x + inset,
119
+ y: H - box.y - inset,
120
+ color: box.fill ? rgb(...box.fill) : undefined,
121
+ borderColor: edge ? rgb(...edge.colour) : undefined,
122
+ borderWidth: edge?.width
123
+ });
124
+ continue;
125
+ }
126
+ // The browser paints a box from a whole pixel to a whole pixel, and fits
127
+ // the gap of a dashed edge to the length that leaves it.
128
+ if (box.edges.some((edge) => edge?.dashed)) {
129
+ const [x, y] = [Math.round(box.x), Math.round(box.y)];
130
+ box = { ...box, x, y, w: Math.round(box.x + box.w) - x, h: Math.round(box.y + box.h) - y };
131
+ }
132
+ if (box.fill)
133
+ page.drawRectangle({
134
+ x: box.x,
135
+ y: H - box.y - box.h,
136
+ width: box.w,
137
+ height: box.h,
138
+ color: rgb(...box.fill),
139
+ borderWidth: 0
140
+ });
141
+ const [top, right, bottom, left] = box.edges;
142
+ const seg = (x1, y1, x2, y2, edge) => page.drawLine({
143
+ start: { x: x1, y: H - y1 },
144
+ end: { x: x2, y: H - y2 },
145
+ thickness: edge.width,
146
+ color: rgb(...edge.colour),
147
+ dashArray: edge.dashed ? dashes(edge.width, x2 - x1 + y2 - y1) : undefined
148
+ });
149
+ if (top)
150
+ seg(box.x, box.y + top.width / 2, box.x + box.w, box.y + top.width / 2, top);
151
+ if (bottom)
152
+ seg(box.x, box.y + box.h - bottom.width / 2, box.x + box.w, box.y + box.h - bottom.width / 2, bottom);
153
+ if (left)
154
+ seg(box.x + left.width / 2, box.y, box.x + left.width / 2, box.y + box.h, left);
155
+ if (right)
156
+ seg(box.x + box.w - right.width / 2, box.y, box.x + box.w - right.width / 2, box.y + box.h, right);
157
+ }
158
+ }
159
+ /**
160
+ * The dash and the gap the browser paints along a dashed edge, or nothing for
161
+ * an edge it paints whole. A dash is three widths and a gap two for an edge
162
+ * under 3 px wide, and two and one from there. An edge too short for two
163
+ * dashes is whole, and one too short for two dashes and a whole gap has both
164
+ * shortened alike. On any other the gap is fitted so that the edge starts and
165
+ * ends on a whole dash: of the two counts of dashes its length lies between,
166
+ * it has the one whose gap is nearer.
167
+ */
168
+ function dashes(width, length) {
169
+ const [dash, gap] = width < 3 ? [3 * width, 2 * width] : [2 * width, width];
170
+ if (length <= 2 * dash)
171
+ return undefined;
172
+ const short = length / (2 * dash + gap);
173
+ if (short <= 1)
174
+ return [dash * short, gap * short];
175
+ const count = Math.floor((length + gap) / (dash + gap));
176
+ const fit = (dashes) => (length - dashes * dash) / (dashes - 1);
177
+ const [wide, narrow] = [fit(count), fit(count + 1)];
178
+ return [dash, narrow <= 0 || Math.abs(wide - gap) < Math.abs(narrow - gap) ? wide : narrow];
179
+ }
180
+ /** The standard fonts that hold what the text fonts lack, in the order a character is looked for. */
181
+ const SYMBOLS = [StandardFonts.Symbol, StandardFonts.ZapfDingbats];
182
+ async function drawRun(page, pageNumber, run, H, get) {
183
+ const font = await get(standard14(run));
184
+ // The standard-14 text fonts encode WinAnsi alone. U+2010 and U+2011 are
185
+ // drawn as its hyphen, and any other character outside it in the first of
186
+ // SYMBOLS that holds it. A soft hyphen is left out: WinAnsi has it as a
187
+ // hyphen, and the browser lays it out at no width and shows nothing.
188
+ // Dropping the run would lose a line of the form without anything
189
+ // reporting it.
190
+ // pdf-lib kerns the width it measures and writes no kerning, so the width
191
+ // it draws a run at is the sum of the widths of its characters.
192
+ const parts = [];
193
+ let natural = 0;
194
+ for (const char of run.text.replaceAll('\u00ad', '').replace(/[\u2010\u2011]/g, '-')) {
195
+ const code = char.codePointAt(0);
196
+ let face = font;
197
+ for (const name of SYMBOLS)
198
+ if (!face.getCharacterSet().includes(code))
199
+ face = await get(name);
200
+ if (!face.getCharacterSet().includes(code))
201
+ throw new Refused({
202
+ code: 'unpaintable',
203
+ page: pageNumber - 1,
204
+ construct: 'glyph',
205
+ detail: run.text.slice(0, 40)
206
+ });
207
+ const last = parts.at(-1);
208
+ if (last?.font === face)
209
+ last.text += char;
210
+ else
211
+ parts.push({ font: face, text: char, at: natural });
212
+ natural += face.widthOfTextAtSize(char, run.size) + run.letterSpacing;
213
+ }
214
+ // The standard-14 substitute's advances differ from the embedded face's.
215
+ // Letter spacing goes in first, since it is a real property of the run;
216
+ // horizontal scaling then pins the whole run to the width the browser
217
+ // measured, so the error stays inside the run instead of drifting across
218
+ // the line.
219
+ const spaced = natural - run.letterSpacing;
220
+ const scale = spaced > 0 && run.width > 0 ? Math.max(50, Math.min(200, (100 * run.width) / spaced)) : 100;
221
+ const scaled = Math.abs(scale - 100) > 3;
222
+ // Both are text-state parameters, so they persist across drawText's own
223
+ // BT/ET and have to be put back.
224
+ if (run.letterSpacing)
225
+ page.pushOperators(PDFOperator.of(PDFOperatorNames.SetCharacterSpacing, [String(+run.letterSpacing.toFixed(4))]));
226
+ if (scaled)
227
+ page.pushOperators(PDFOperator.of(PDFOperatorNames.SetTextHorizontalScaling, [String(+scale.toFixed(3))]));
228
+ const angle = (Math.PI / 2) * (run.turn ?? 0);
229
+ for (const part of parts) {
230
+ const along = scaled ? (part.at * scale) / 100 : part.at;
231
+ page.drawText(part.text, {
232
+ x: run.x + along * Math.cos(angle),
233
+ y: H - run.baseline + along * Math.sin(angle),
234
+ size: run.size,
235
+ font: part.font,
236
+ color: rgb(...run.colour),
237
+ rotate: degrees(90 * (run.turn ?? 0))
238
+ });
239
+ }
240
+ if (scaled)
241
+ page.pushOperators(PDFOperator.of(PDFOperatorNames.SetTextHorizontalScaling, ['100']));
242
+ if (run.letterSpacing)
243
+ page.pushOperators(PDFOperator.of(PDFOperatorNames.SetCharacterSpacing, ['0']));
244
+ }
245
+ function standard14(run) {
246
+ const family = run.family.toLowerCase();
247
+ if (family.includes('courier') || family.includes('mono'))
248
+ return run.bold && run.italic
249
+ ? StandardFonts.CourierBoldOblique
250
+ : run.bold
251
+ ? StandardFonts.CourierBold
252
+ : run.italic
253
+ ? StandardFonts.CourierOblique
254
+ : StandardFonts.Courier;
255
+ if (family.includes('times') || (family.includes('serif') && !family.includes('sans')))
256
+ return run.bold && run.italic
257
+ ? StandardFonts.TimesRomanBoldItalic
258
+ : run.bold
259
+ ? StandardFonts.TimesRomanBold
260
+ : run.italic
261
+ ? StandardFonts.TimesRomanItalic
262
+ : StandardFonts.TimesRoman;
263
+ return run.bold && run.italic
264
+ ? StandardFonts.HelveticaBoldOblique
265
+ : run.bold
266
+ ? StandardFonts.HelveticaBold
267
+ : run.italic
268
+ ? StandardFonts.HelveticaOblique
269
+ : StandardFonts.Helvetica;
270
+ }
271
+ /**
272
+ * The fields, as the shapes the inventory already understands. Radios become a
273
+ * real AcroForm radio group, so the inventory reads each option's group and
274
+ * on-state as it reads a static form's.
275
+ *
276
+ * For a text field, a checkbox and a dropdown pdf-lib asks whether
277
+ * `backgroundColor` and `borderColor` are `in` the options, and defaults a
278
+ * missing background to white and a missing border to black, so both are
279
+ * passed as undefined. Left out, each paints a white box with a black border
280
+ * over the page. A radio option takes those defaults whatever is passed, with
281
+ * a border of no width.
282
+ *
283
+ * The fields are flat, each made from pdf-lib's own field class with its whole
284
+ * name as its `/T`. pdf-lib's form would read a period in the name as a level
285
+ * of its field tree, and holds no name as both a field and the parent of one,
286
+ * which a field named as the subform beside it asks for. pdf.js joins the `/T`
287
+ * of a field's ancestors with periods, so the inventory reads the whole name.
288
+ *
289
+ * A signature field is a dictionary of the keys the inventory reads, since
290
+ * pdf-lib has no class that creates one.
291
+ */
292
+ function stamp(doc, widgets) {
293
+ const { acroForm } = doc.getForm();
294
+ const pages = doc.getPages();
295
+ const chrome = { borderWidth: 0, backgroundColor: undefined, borderColor: undefined };
296
+ const groups = new Map();
297
+ const states = new Map();
298
+ const rooted = (acro, name, of) => {
299
+ acro.setPartialName(name);
300
+ acroForm.addField(acro.ref);
301
+ return of(acro, acro.ref, doc);
302
+ };
303
+ for (const widget of widgets) {
304
+ const page = pages[widget.page];
305
+ const box = {
306
+ x: widget.x,
307
+ y: page.getHeight() - widget.y - widget.h,
308
+ width: widget.w,
309
+ height: widget.h,
310
+ ...chrome
311
+ };
312
+ if (widget.kind === 'radio' && widget.group) {
313
+ let group = groups.get(widget.group);
314
+ if (!group) {
315
+ group = rooted(PDFAcroRadioButton.create(doc.context), widget.group, PDFRadioGroup.of);
316
+ groups.set(widget.group, group);
317
+ states.set(widget.group, new Set());
318
+ }
319
+ // Two members of one group cannot share an on-state, or picking either
320
+ // picks both.
321
+ const used = states.get(widget.group);
322
+ let on = widget.on || 'option';
323
+ for (let n = 2; used.has(on); n++)
324
+ on = `${widget.on || 'option'}${n}`;
325
+ used.add(on);
326
+ group.addOptionToPage(on, page, box);
327
+ tooltip(group, widget.tooltip);
328
+ continue;
329
+ }
330
+ if (widget.kind === 'checkbox') {
331
+ const tick = rooted(PDFAcroCheckBox.create(doc.context), widget.name, PDFCheckBox.of);
332
+ tick.addToPage(page, box);
333
+ tooltip(tick, widget.tooltip);
334
+ continue;
335
+ }
336
+ if (widget.kind === 'choice') {
337
+ const dropdown = rooted(PDFAcroComboBox.create(doc.context), widget.name, PDFDropdown.of);
338
+ dropdown.addOptions(widget.options.length ? widget.options : ['']);
339
+ dropdown.addToPage(page, box);
340
+ tooltip(dropdown, widget.tooltip);
341
+ continue;
342
+ }
343
+ if (widget.kind === 'signature') {
344
+ const ref = doc.context.register(doc.context.obj({
345
+ FT: 'Sig',
346
+ Subtype: 'Widget',
347
+ T: PDFHexString.fromText(widget.name),
348
+ Rect: [box.x, box.y, box.x + box.width, box.y + box.height],
349
+ ...(widget.tooltip ? { TU: PDFHexString.fromText(widget.tooltip) } : {})
350
+ }));
351
+ page.node.addAnnot(ref);
352
+ acroForm.addField(ref);
353
+ continue;
354
+ }
355
+ const field = rooted(PDFAcroText.create(doc.context), widget.name, PDFTextField.of);
356
+ if (widget.kind === 'multiline')
357
+ field.enableMultiline();
358
+ field.addToPage(page, box);
359
+ tooltip(field, widget.tooltip);
360
+ }
361
+ }
362
+ /** `/TU`, which the inventory reads as the widget's tooltip. */
363
+ function tooltip(field, text) {
364
+ if (!text)
365
+ return;
366
+ // Written on the widget just added. `addToPage` and `addOptionToPage` push
367
+ // into `/Kids`, so writing to every kid would give each option of a radio
368
+ // group the last option's caption.
369
+ const widget = field.acroField.getWidgets().at(-1);
370
+ widget?.dict.set(PDFName.of('TU'), PDFHexString.fromText(text));
371
+ }
@@ -0,0 +1,102 @@
1
+ Digitized data copyright (c) 2010 Google Corporation
2
+ with Reserved Font Arimo, Tinos and Cousine.
3
+ Copyright (c) 2012 Red Hat, Inc.
4
+ with Reserved Font Name Liberation.
5
+
6
+ This Font Software is licensed under the SIL Open Font License,
7
+ Version 1.1.
8
+
9
+ This license is copied below, and is also available with a FAQ at:
10
+ http://scripts.sil.org/OFL
11
+
12
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
13
+
14
+ PREAMBLE The goals of the Open Font License (OFL) are to stimulate
15
+ worldwide development of collaborative font projects, to support the font
16
+ creation efforts of academic and linguistic communities, and to provide
17
+ a free and open framework in which fonts may be shared and improved in
18
+ partnership with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves.
22
+ The fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply to
27
+ any document created using the fonts or their derivatives.
28
+
29
+
30
+
31
+ DEFINITIONS
32
+ "Font Software" refers to the set of files released by the Copyright
33
+ Holder(s) under this license and clearly marked as such.
34
+ This may include source files, build scripts and documentation.
35
+
36
+ "Reserved Font Name" refers to any names specified as such after the
37
+ copyright statement(s).
38
+
39
+ "Original Version" refers to the collection of Font Software components
40
+ as distributed by the Copyright Holder(s).
41
+
42
+ "Modified Version" refers to any derivative made by adding to, deleting,
43
+ or substituting ? in part or in whole ?
44
+ any of the components of the Original Version, by changing formats or
45
+ by porting the Font Software to a new environment.
46
+
47
+ "Author" refers to any designer, engineer, programmer, technical writer
48
+ or other person who contributed to the Font Software.
49
+
50
+
51
+ PERMISSION & CONDITIONS
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining a
54
+ copy of the Font Software, to use, study, copy, merge, embed, modify,
55
+ redistribute, and sell modified and unmodified copies of the Font
56
+ Software, subject to the following conditions:
57
+
58
+ 1) Neither the Font Software nor any of its individual components,in
59
+ Original or Modified Versions, may be sold by itself.
60
+
61
+ 2) Original or Modified Versions of the Font Software may be bundled,
62
+ redistributed and/or sold with any software, provided that each copy
63
+ contains the above copyright notice and this license. These can be
64
+ included either as stand-alone text files, human-readable headers or
65
+ in the appropriate machine-readable metadata fields within text or
66
+ binary files as long as those fields can be easily viewed by the user.
67
+
68
+ 3) No Modified Version of the Font Software may use the Reserved Font
69
+ Name(s) unless explicit written permission is granted by the
70
+ corresponding Copyright Holder. This restriction only applies to the
71
+ primary font name as presented to the users.
72
+
73
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
74
+ Software shall not be used to promote, endorse or advertise any
75
+ Modified Version, except to acknowledge the contribution(s) of the
76
+ Copyright Holder(s) and the Author(s) or with their explicit written
77
+ permission.
78
+
79
+ 5) The Font Software, modified or unmodified, in part or in whole, must
80
+ be distributed entirely under this license, and must not be distributed
81
+ under any other license. The requirement for fonts to remain under
82
+ this license does not apply to any document created using the Font
83
+ Software.
84
+
85
+
86
+
87
+ TERMINATION
88
+ This license becomes null and void if any of the above conditions are not met.
89
+
90
+
91
+
92
+ DISCLAIMER
93
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
94
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
95
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
96
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
97
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
98
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
99
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
100
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
101
+ DEALINGS IN THE FONT SOFTWARE.
102
+