@syncfusion/ej2-pdf-export 20.2.45 → 20.3.56

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 (154) hide show
  1. package/dist/ej2-pdf-export.min.js +10 -0
  2. package/dist/ej2-pdf-export.umd.min.js +1 -1
  3. package/dist/global/ej2-pdf-export.min.js +1 -1
  4. package/dist/global/index.d.ts +1 -1
  5. package/dist/ts/implementation/actions/action.ts +76 -0
  6. package/dist/ts/implementation/actions/uri-action.ts +52 -0
  7. package/dist/ts/implementation/annotations/action-link-annotation.ts +43 -0
  8. package/dist/ts/implementation/annotations/annotation-collection.ts +159 -0
  9. package/dist/ts/implementation/annotations/annotation.ts +241 -0
  10. package/dist/ts/implementation/annotations/document-link-annotation.ts +118 -0
  11. package/dist/ts/implementation/annotations/link-annotation.ts +32 -0
  12. package/dist/ts/implementation/annotations/pdf-text-web-link.ts +265 -0
  13. package/dist/ts/implementation/annotations/uri-annotation.ts +86 -0
  14. package/dist/ts/implementation/collections/dictionary.ts +150 -0
  15. package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +125 -0
  16. package/dist/ts/implementation/collections/utils.ts +38 -0
  17. package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +39 -0
  18. package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +108 -0
  19. package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +127 -0
  20. package/dist/ts/implementation/document/automatic-fields/composite-field.ts +76 -0
  21. package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +37 -0
  22. package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +75 -0
  23. package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +157 -0
  24. package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +82 -0
  25. package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +60 -0
  26. package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +48 -0
  27. package/dist/ts/implementation/document/pdf-catalog.ts +52 -0
  28. package/dist/ts/implementation/document/pdf-document-base.ts +166 -0
  29. package/dist/ts/implementation/document/pdf-document-template.ts +310 -0
  30. package/dist/ts/implementation/document/pdf-document.ts +342 -0
  31. package/dist/ts/implementation/drawing/pdf-drawing.ts +218 -0
  32. package/dist/ts/implementation/general/enum.ts +21 -0
  33. package/dist/ts/implementation/general/functions/pdf-function.ts +66 -0
  34. package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +62 -0
  35. package/dist/ts/implementation/general/pdf-cache-collection.ts +97 -0
  36. package/dist/ts/implementation/general/pdf-collection.ts +41 -0
  37. package/dist/ts/implementation/general/pdf-destination.ts +170 -0
  38. package/dist/ts/implementation/graphics/brushes/enum.ts +237 -0
  39. package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +294 -0
  40. package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +68 -0
  41. package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +2438 -0
  42. package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +295 -0
  43. package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +311 -0
  44. package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +406 -0
  45. package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +290 -0
  46. package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +107 -0
  47. package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +304 -0
  48. package/dist/ts/implementation/graphics/constants.ts +31 -0
  49. package/dist/ts/implementation/graphics/enum.ts +413 -0
  50. package/dist/ts/implementation/graphics/figures/arc.ts +133 -0
  51. package/dist/ts/implementation/graphics/figures/base/draw-element.ts +59 -0
  52. package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +260 -0
  53. package/dist/ts/implementation/graphics/figures/base/fill-element.ts +72 -0
  54. package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +34 -0
  55. package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +69 -0
  56. package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +276 -0
  57. package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +205 -0
  58. package/dist/ts/implementation/graphics/figures/ellipse-part.ts +76 -0
  59. package/dist/ts/implementation/graphics/figures/enum.ts +80 -0
  60. package/dist/ts/implementation/graphics/figures/layout-element.ts +132 -0
  61. package/dist/ts/implementation/graphics/figures/path.ts +646 -0
  62. package/dist/ts/implementation/graphics/figures/pdf-template.ts +205 -0
  63. package/dist/ts/implementation/graphics/figures/rectangle-area.ts +108 -0
  64. package/dist/ts/implementation/graphics/figures/text-element.ts +445 -0
  65. package/dist/ts/implementation/graphics/fonts/enum.ts +385 -0
  66. package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +248 -0
  67. package/dist/ts/implementation/graphics/fonts/pdf-font.ts +316 -0
  68. package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +606 -0
  69. package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +243 -0
  70. package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +474 -0
  71. package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +165 -0
  72. package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +958 -0
  73. package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +374 -0
  74. package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +255 -0
  75. package/dist/ts/implementation/graphics/fonts/string-layouter.ts +617 -0
  76. package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +275 -0
  77. package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +206 -0
  78. package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +18 -0
  79. package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +18 -0
  80. package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +14 -0
  81. package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +26 -0
  82. package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +35 -0
  83. package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +94 -0
  84. package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +56 -0
  85. package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +10 -0
  86. package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +14 -0
  87. package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +106 -0
  88. package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +58 -0
  89. package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +33 -0
  90. package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +22 -0
  91. package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +42 -0
  92. package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +1254 -0
  93. package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +26 -0
  94. package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +26 -0
  95. package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +577 -0
  96. package/dist/ts/implementation/graphics/images/byte-array.ts +137 -0
  97. package/dist/ts/implementation/graphics/images/image-decoder.ts +437 -0
  98. package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +110 -0
  99. package/dist/ts/implementation/graphics/images/pdf-image.ts +132 -0
  100. package/dist/ts/implementation/graphics/pdf-color.ts +478 -0
  101. package/dist/ts/implementation/graphics/pdf-graphics.ts +2424 -0
  102. package/dist/ts/implementation/graphics/pdf-margins.ts +124 -0
  103. package/dist/ts/implementation/graphics/pdf-pen.ts +370 -0
  104. package/dist/ts/implementation/graphics/pdf-resources.ts +300 -0
  105. package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +246 -0
  106. package/dist/ts/implementation/graphics/pdf-transparency.ts +93 -0
  107. package/dist/ts/implementation/graphics/unit-convertor.ts +96 -0
  108. package/dist/ts/implementation/input-output/big-endian-writer.ts +121 -0
  109. package/dist/ts/implementation/input-output/cross-table.ts +21 -0
  110. package/dist/ts/implementation/input-output/enum.ts +16 -0
  111. package/dist/ts/implementation/input-output/pdf-cross-table.ts +524 -0
  112. package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +515 -0
  113. package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +194 -0
  114. package/dist/ts/implementation/input-output/pdf-operators.ts +363 -0
  115. package/dist/ts/implementation/input-output/pdf-stream-writer.ts +681 -0
  116. package/dist/ts/implementation/input-output/pdf-writer.ts +88 -0
  117. package/dist/ts/implementation/pages/enum.ts +201 -0
  118. package/dist/ts/implementation/pages/page-added-event-arguments.ts +39 -0
  119. package/dist/ts/implementation/pages/pdf-document-page-collection.ts +180 -0
  120. package/dist/ts/implementation/pages/pdf-page-base.ts +181 -0
  121. package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +348 -0
  122. package/dist/ts/implementation/pages/pdf-page-layer.ts +271 -0
  123. package/dist/ts/implementation/pages/pdf-page-settings.ts +192 -0
  124. package/dist/ts/implementation/pages/pdf-page-size.ts +162 -0
  125. package/dist/ts/implementation/pages/pdf-page-template-element.ts +659 -0
  126. package/dist/ts/implementation/pages/pdf-page.ts +235 -0
  127. package/dist/ts/implementation/pages/pdf-section-collection.ts +187 -0
  128. package/dist/ts/implementation/pages/pdf-section-page-collection.ts +61 -0
  129. package/dist/ts/implementation/pages/pdf-section-templates.ts +96 -0
  130. package/dist/ts/implementation/pages/pdf-section.ts +644 -0
  131. package/dist/ts/implementation/primitives/pdf-array.ts +386 -0
  132. package/dist/ts/implementation/primitives/pdf-boolean.ts +119 -0
  133. package/dist/ts/implementation/primitives/pdf-dictionary.ts +513 -0
  134. package/dist/ts/implementation/primitives/pdf-name.ts +218 -0
  135. package/dist/ts/implementation/primitives/pdf-number.ts +165 -0
  136. package/dist/ts/implementation/primitives/pdf-reference.ts +430 -0
  137. package/dist/ts/implementation/primitives/pdf-stream.ts +336 -0
  138. package/dist/ts/implementation/primitives/pdf-string.ts +397 -0
  139. package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +2027 -0
  140. package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +1189 -0
  141. package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +206 -0
  142. package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +470 -0
  143. package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +853 -0
  144. package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +240 -0
  145. package/dist/ts/implementation/structured-elements/grid/styles/style.ts +424 -0
  146. package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +16 -0
  147. package/dist/ts/interfaces/i-pdf-cache.ts +23 -0
  148. package/dist/ts/interfaces/i-pdf-changable.ts +17 -0
  149. package/dist/ts/interfaces/i-pdf-clonable.ts +12 -0
  150. package/dist/ts/interfaces/i-pdf-primitives.ts +45 -0
  151. package/dist/ts/interfaces/i-pdf-true-type-font.ts +48 -0
  152. package/dist/ts/interfaces/i-pdf-wrapper.ts +13 -0
  153. package/dist/ts/interfaces/i-pdf-writer.ts +29 -0
  154. package/package.json +9 -8
@@ -0,0 +1,606 @@
1
+ /**
2
+ * PdfStandardFontMetricsFactory.ts class for EJ2-PDF
3
+ */
4
+ import { PdfFontStyle, PdfFontFamily } from './enum';
5
+ import { PdfFontMetrics, StandardWidthTable } from './pdf-font-metrics';
6
+ /**
7
+ * @private
8
+ * `Factory of the standard fonts metrics`.
9
+ */
10
+ export class PdfStandardFontMetricsFactory {
11
+ /**
12
+ * `Multiplier` os subscript superscript.
13
+ * @private
14
+ */
15
+ private static readonly subSuperScriptFactor : number = 1.52;
16
+ /**
17
+ * `Ascender` value for the font.
18
+ * @private
19
+ */
20
+ private static readonly helveticaAscent : number = 931;
21
+ /**
22
+ * `Ascender` value for the font.
23
+ * @private
24
+ */
25
+ private static readonly helveticaDescent : number = -225;
26
+ /**
27
+ * `Font type`.
28
+ * @private
29
+ */
30
+ private static readonly helveticaName : string = 'Helvetica';
31
+ /**
32
+ * `Ascender` value for the font.
33
+ * @private
34
+ */
35
+ private static readonly helveticaBoldAscent : number = 962;
36
+ /**
37
+ * `Ascender` value for the font.
38
+ * @private
39
+ */
40
+ private static readonly helveticaBoldDescent : number = -228;
41
+ /**
42
+ * `Font type`.
43
+ * @private
44
+ */
45
+ private static readonly helveticaBoldName : string = 'Helvetica-Bold';
46
+ /**
47
+ * `Ascender` value for the font.
48
+ * @private
49
+ */
50
+ private static readonly helveticaItalicAscent : number = 931;
51
+ /**
52
+ * `Ascender` value for the font.
53
+ * @private
54
+ */
55
+ private static readonly helveticaItalicDescent : number = -225;
56
+ /**
57
+ * `Font type`.
58
+ * @private
59
+ */
60
+ private static readonly helveticaItalicName : string = 'Helvetica-Oblique';
61
+ /**
62
+ * `Ascender` value for the font.
63
+ * @private
64
+ */
65
+ private static readonly helveticaBoldItalicAscent : number = 962;
66
+ /**
67
+ * `Ascender` value for the font.
68
+ * @private
69
+ */
70
+ private static readonly helveticaBoldItalicDescent : number = -228;
71
+ /**
72
+ * `Font type`.
73
+ * @private
74
+ */
75
+ private static readonly helveticaBoldItalicName : string = 'Helvetica-BoldOblique';
76
+ /**
77
+ * `Ascender` value for the font.
78
+ * @private
79
+ */
80
+ private static readonly courierAscent : number = 805;
81
+ /**
82
+ * `Ascender` value for the font.
83
+ * @private
84
+ */
85
+ private static readonly courierDescent : number = -250;
86
+ /**
87
+ * `Font type`.
88
+ * @private
89
+ */
90
+ private static readonly courierName : string = 'Courier';
91
+ /**
92
+ * `Ascender` value for the font.
93
+ * @private
94
+ */
95
+ private static readonly courierBoldAscent : number = 801;
96
+ /**
97
+ * `Ascender` value for the font.
98
+ * @private
99
+ */
100
+ private static readonly courierBoldDescent : number = -250;
101
+ /**
102
+ * `Font type`.
103
+ * @private
104
+ */
105
+ private static readonly courierBoldName : string = 'Courier-Bold';
106
+ /**
107
+ * `Ascender` value for the font.
108
+ * @private
109
+ */
110
+ private static readonly courierItalicAscent : number = 805;
111
+ /**
112
+ * `Ascender` value for the font.
113
+ * @private
114
+ */
115
+ private static readonly courierItalicDescent : number = -250;
116
+ /**
117
+ * `Font type`.
118
+ * @private
119
+ */
120
+ private static readonly courierItalicName : string = 'Courier-Oblique';
121
+ /**
122
+ * `Ascender` value for the font.
123
+ * @private
124
+ */
125
+ private static readonly courierBoldItalicAscent : number = 801;
126
+ /**
127
+ * `Ascender` value for the font.
128
+ * @private
129
+ */
130
+ private static readonly courierBoldItalicDescent : number = -250;
131
+ /**
132
+ * `Font type`.
133
+ * @private
134
+ */
135
+ private static readonly courierBoldItalicName : string = 'Courier-BoldOblique';
136
+ /**
137
+ * `Ascender` value for the font.
138
+ * @private
139
+ */
140
+ private static readonly timesAscent : number = 898;
141
+ /**
142
+ * `Ascender` value for the font.
143
+ * @private
144
+ */
145
+ private static readonly timesDescent : number = -218;
146
+ /**
147
+ * `Font type`.
148
+ * @private
149
+ */
150
+ private static readonly timesName : string = 'Times-Roman';
151
+ /**
152
+ * `Ascender` value for the font.
153
+ * @private
154
+ */
155
+ private static readonly timesBoldAscent : number = 935;
156
+ /**
157
+ * `Ascender` value for the font.
158
+ * @private
159
+ */
160
+ private static readonly timesBoldDescent : number = -218;
161
+ /**
162
+ * `Font type`.
163
+ * @private
164
+ */
165
+ private static readonly timesBoldName : string = 'Times-Bold';
166
+ /**
167
+ * `Ascender` value for the font.
168
+ * @private
169
+ */
170
+ private static readonly timesItalicAscent : number = 883;
171
+ /**
172
+ * `Ascender` value for the font.
173
+ * @private
174
+ */
175
+ private static readonly timesItalicDescent : number = -217;
176
+ /**
177
+ * `Font type`.
178
+ * @private
179
+ */
180
+ private static readonly timesItalicName : string = 'Times-Italic';
181
+ /**
182
+ * `Ascender` value for the font.
183
+ * @private
184
+ */
185
+ private static readonly timesBoldItalicAscent : number = 921;
186
+ /**
187
+ * `Ascender` value for the font.
188
+ * @private
189
+ */
190
+ private static readonly timesBoldItalicDescent : number = -218;
191
+ /**
192
+ * `Font type`.
193
+ * @private
194
+ */
195
+ private static readonly timesBoldItalicName : string = 'Times-BoldItalic';
196
+ /**
197
+ * `Ascender` value for the font.
198
+ * @private
199
+ */
200
+ private static readonly symbolAscent : number = 1010;
201
+ /**
202
+ * `Ascender` value for the font.
203
+ * @private
204
+ */
205
+ private static readonly symbolDescent : number = -293;
206
+ /**
207
+ * `Font type`.
208
+ * @private
209
+ */
210
+ private static readonly symbolName : string = 'Symbol';
211
+ /**
212
+ * `Ascender` value for the font.
213
+ * @private
214
+ */
215
+ private static readonly zapfDingbatsAscent : number = 820;
216
+ /**
217
+ * `Ascender` value for the font.
218
+ * @private
219
+ */
220
+ private static readonly zapfDingbatsDescent : number = -143;
221
+ /**
222
+ * `Font type`.
223
+ * @private
224
+ */
225
+ private static readonly zapfDingbatsName : string = 'ZapfDingbats';
226
+ /**
227
+ * `Arial` widths table.
228
+ * @private
229
+ */
230
+ private static arialWidth : number[] =
231
+ [
232
+ 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333,
233
+ 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584,
234
+ 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833,
235
+ 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278,
236
+ 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833,
237
+ 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334,
238
+ 584, 0, 556, 0, 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, 1000, 0,
239
+ 611, 0, 0, 222, 222, 333, 333, 350, 556, 1000, 333, 1000, 500, 333, 944, 0,
240
+ 500, 667, 0, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 0,
241
+ 737, 333, 400, 584, 333, 333, 333, 556, 537, 278, 333, 333, 365, 556, 834, 834,
242
+ 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278,
243
+ 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667,
244
+ 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278,
245
+ 278, 278, 556, 556, 556, 556, 556, 556, 556, 584, 611, 556, 556, 556, 556, 500,
246
+ 556, 500
247
+ ];
248
+ /**
249
+ * `Arial bold` widths table.
250
+ * @private
251
+ */
252
+ private static arialBoldWidth : number[] =
253
+ [
254
+ 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333,
255
+ 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584,
256
+ 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833,
257
+ 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333,
258
+ 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889,
259
+ 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389,
260
+ 584, 0, 556, 0, 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, 1000, 0,
261
+ 611, 0, 0, 278, 278, 500, 500, 350, 556, 1000, 333, 1000, 556, 333, 944, 0,
262
+ 500, 667, 0, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 0,
263
+ 737, 333, 400, 584, 333, 333, 333, 611, 556, 278, 333, 333, 365, 556, 834, 834,
264
+ 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278,
265
+ 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667,
266
+ 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278,
267
+ 278, 278, 611, 611, 611, 611, 611, 611, 611, 584, 611, 611, 611, 611, 611, 556,
268
+ 611, 556
269
+ ];
270
+ /**
271
+ * `Fixed` widths table.
272
+ * @private
273
+ */
274
+ private static fixedWidth : number[] =
275
+ [
276
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
277
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
278
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
279
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
280
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
281
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
282
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
283
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
284
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
285
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
286
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
287
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
288
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
289
+ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600
290
+ ];
291
+ /**
292
+ * `Times` widths table.
293
+ * @private
294
+ */
295
+ private static timesRomanWidth : number[] =
296
+ [
297
+ 250, 333, 408, 500, 500, 833, 778, 180, 333, 333, 500, 564, 250, 333,
298
+ 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 564, 564,
299
+ 564, 444, 921, 722, 667, 667, 722, 611, 556, 722, 722, 333, 389, 722, 611, 889,
300
+ 722, 722, 556, 722, 667, 556, 611, 722, 722, 944, 722, 722, 611, 333, 278, 333,
301
+ 469, 500, 333, 444, 500, 444, 500, 444, 333, 500, 500, 278, 278, 500, 278, 778,
302
+ 500, 500, 500, 500, 333, 389, 278, 500, 500, 722, 500, 500, 444, 480, 200, 480,
303
+ 541, 0, 500, 0, 333, 500, 444, 1000, 500, 500, 333, 1000, 556, 333, 889, 0,
304
+ 611, 0, 0, 333, 333, 444, 444, 350, 500, 1000, 333, 980, 389, 333, 722, 0,
305
+ 444, 722, 0, 333, 500, 500, 500, 500, 200, 500, 333, 760, 276, 500, 564, 0,
306
+ 760, 333, 400, 564, 300, 300, 333, 500, 453, 250, 333, 300, 310, 500, 750, 750,
307
+ 750, 444, 722, 722, 722, 722, 722, 722, 889, 667, 611, 611, 611, 611, 333, 333,
308
+ 333, 333, 722, 722, 722, 722, 722, 722, 722, 564, 722, 722, 722, 722, 722, 722,
309
+ 556, 500, 444, 444, 444, 444, 444, 444, 667, 444, 444, 444, 444, 444, 278, 278,
310
+ 278, 278, 500, 500, 500, 500, 500, 500, 500, 564, 500, 500, 500, 500, 500, 500,
311
+ 500, 500
312
+ ];
313
+ /**
314
+ * `Times bold` widths table.
315
+ * @private
316
+ */
317
+ private static timesRomanBoldWidth : number[] =
318
+ [
319
+ 250, 333, 555, 500, 500, 1000, 833, 278, 333, 333, 500, 570, 250, 333,
320
+ 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570,
321
+ 570, 500, 930, 722, 667, 722, 722, 667, 611, 778, 778, 389, 500, 778, 667, 944,
322
+ 722, 778, 611, 778, 722, 556, 667, 722, 722, 1000, 722, 722, 667, 333, 278, 333,
323
+ 581, 500, 333, 500, 556, 444, 556, 444, 333, 500, 556, 278, 333, 556, 278, 833,
324
+ 556, 500, 556, 556, 444, 389, 333, 556, 500, 722, 500, 500, 444, 394, 220, 394,
325
+ 520, 0, 500, 0, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 1000, 0,
326
+ 667, 0, 0, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 0,
327
+ 444, 722, 0, 333, 500, 500, 500, 500, 220, 500, 333, 747, 300, 500, 570, 0,
328
+ 747, 333, 400, 570, 300, 300, 333, 556, 540, 250, 333, 300, 330, 500, 750, 750,
329
+ 750, 500, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 389, 389,
330
+ 389, 389, 722, 722, 778, 778, 778, 778, 778, 570, 778, 722, 722, 722, 722, 722,
331
+ 611, 556, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278,
332
+ 278, 278, 500, 556, 500, 500, 500, 500, 500, 570, 500, 556, 556, 556, 556, 500,
333
+ 556, 500
334
+ ];
335
+ /**
336
+ * `Times italic` widths table.
337
+ * @private
338
+ */
339
+ private static timesRomanItalicWidth : number[] =
340
+ [
341
+ 250, 333, 420, 500, 500, 833, 778, 214, 333, 333, 500, 675, 250, 333,
342
+ 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 675, 675,
343
+ 675, 500, 920, 611, 611, 667, 722, 611, 611, 722, 722, 333, 444, 667, 556, 833,
344
+ 667, 722, 611, 722, 611, 500, 556, 722, 611, 833, 611, 556, 556, 389, 278, 389,
345
+ 422, 500, 333, 500, 500, 444, 500, 444, 278, 500, 500, 278, 278, 444, 278, 722,
346
+ 500, 500, 500, 500, 389, 389, 278, 500, 444, 667, 444, 444, 389, 400, 275, 400,
347
+ 541, 0, 500, 0, 333, 500, 556, 889, 500, 500, 333, 1000, 500, 333, 944, 0,
348
+ 556, 0, 0, 333, 333, 556, 556, 350, 500, 889, 333, 980, 389, 333, 667, 0,
349
+ 389, 556, 0, 389, 500, 500, 500, 500, 275, 500, 333, 760, 276, 500, 675, 0,
350
+ 760, 333, 400, 675, 300, 300, 333, 500, 523, 250, 333, 300, 310, 500, 750, 750,
351
+ 750, 500, 611, 611, 611, 611, 611, 611, 889, 667, 611, 611, 611, 611, 333, 333,
352
+ 333, 333, 722, 667, 722, 722, 722, 722, 722, 675, 722, 722, 722, 722, 722, 556,
353
+ 611, 500, 500, 500, 500, 500, 500, 500, 667, 444, 444, 444, 444, 444, 278, 278,
354
+ 278, 278, 500, 500, 500, 500, 500, 500, 500, 675, 500, 500, 500, 500, 500, 444,
355
+ 500, 444
356
+ ];
357
+ /**
358
+ * `Times bold italic` widths table.
359
+ * @private
360
+ */
361
+ public static timesRomanBoldItalicWidths : number[] =
362
+ [
363
+ 250, 389, 555, 500, 500, 833, 778, 278, 333, 333, 500, 570, 250, 333,
364
+ 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570,
365
+ 570, 500, 832, 667, 667, 667, 722, 667, 667, 722, 778, 389, 500, 667, 611, 889,
366
+ 722, 722, 611, 722, 667, 556, 611, 722, 667, 889, 667, 611, 611, 333, 278, 333,
367
+ 570, 500, 333, 500, 500, 444, 500, 444, 333, 500, 556, 278, 278, 500, 278, 778,
368
+ 556, 500, 500, 500, 389, 389, 278, 556, 444, 667, 500, 444, 389, 348, 220, 348,
369
+ 570, 0, 500, 0, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 944, 0,
370
+ 611, 0, 0, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 0,
371
+ 389, 611, 0, 389, 500, 500, 500, 500, 220, 500, 333, 747, 266, 500, 606, 0,
372
+ 747, 333, 400, 570, 300, 300, 333, 576, 500, 250, 333, 300, 300, 500, 750, 750,
373
+ 750, 500, 667, 667, 667, 667, 667, 667, 944, 667, 667, 667, 667, 667, 389, 389,
374
+ 389, 389, 722, 722, 722, 722, 722, 722, 722, 570, 722, 722, 722, 722, 722, 611,
375
+ 611, 500, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278,
376
+ 278, 278, 500, 556, 500, 500, 500, 500, 500, 570, 500, 556, 556, 556, 556, 444,
377
+ 500, 444
378
+ ];
379
+ /**
380
+ * `Symbol` widths table.
381
+ * @private
382
+ */
383
+ private static symbolWidth : number[] =
384
+ [
385
+ 250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549,
386
+ 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278,
387
+ 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333,
388
+ 631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768,
389
+ 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439,
390
+ 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603,
391
+ 439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 750, 620, 247,
392
+ 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400,
393
+ 549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000,
394
+ 658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713,
395
+ 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603,
396
+ 1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384,
397
+ 384, 384, 384, 494, 494, 494, 494, 329, 274, 686, 686, 686, 384, 384,
398
+ 384, 384, 384, 384, 494, 494, 494, -1
399
+ ];
400
+ /**
401
+ * `Zip dingbats` widths table.
402
+ * @private
403
+ */
404
+ private static zapfDingbatsWidth : number[] =
405
+ [
406
+ 278, 974, 961, 974, 980, 719, 789, 790, 791, 690, 960, 939, 549, 855,
407
+ 911, 933, 911, 945, 974, 755, 846, 762, 761, 571, 677, 763, 760, 759,
408
+ 754, 494, 552, 537, 577, 692, 786, 788, 788, 790, 793, 794, 816, 823,
409
+ 789, 841, 823, 833, 816, 831, 923, 744, 723, 749, 790, 792, 695, 776,
410
+ 768, 792, 759, 707, 708, 682, 701, 826, 815, 789, 789, 707, 687, 696,
411
+ 689, 786, 787, 713, 791, 785, 791, 873, 761, 762, 762, 759, 759, 892,
412
+ 892, 788, 784, 438, 138, 277, 415, 392, 392, 668, 668, 390, 390, 317,
413
+ 317, 276, 276, 509, 509, 410, 410, 234, 234, 334, 334, 732, 544, 544,
414
+ 910, 667, 760, 760, 776, 595, 694, 626, 788, 788, 788, 788, 788, 788,
415
+ 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788,
416
+ 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788,
417
+ 788, 788, 788, 788, 788, 788, 894, 838, 1016, 458, 748, 924, 748, 918,
418
+ 927, 928, 928, 834, 873, 828, 924, 924, 917, 930, 931, 463, 883, 836,
419
+ 836, 867, 867, 696, 696, 874, 874, 760, 946, 771, 865, 771, 888, 967,
420
+ 888, 831, 873, 927, 970, 918
421
+ ];
422
+ /**
423
+ * Returns `metrics` of the font.
424
+ * @private
425
+ */
426
+ public static getMetrics(fontFamily : PdfFontFamily, fontStyle : PdfFontStyle, size : number) : PdfFontMetrics {
427
+ let metrics : PdfFontMetrics = null;
428
+ switch (fontFamily) {
429
+ case PdfFontFamily.Helvetica:
430
+ metrics = this.getHelveticaMetrics(fontFamily, fontStyle, size);
431
+ break;
432
+
433
+ case PdfFontFamily.Courier:
434
+ metrics = this.getCourierMetrics(fontFamily, fontStyle, size);
435
+ break;
436
+
437
+ case PdfFontFamily.TimesRoman:
438
+ metrics = this.getTimesMetrics(fontFamily, fontStyle, size);
439
+ break;
440
+
441
+ case PdfFontFamily.Symbol:
442
+ metrics = this.getSymbolMetrics(fontFamily, fontStyle, size);
443
+ break;
444
+
445
+ case PdfFontFamily.ZapfDingbats:
446
+ metrics = this.getZapfDingbatsMetrics(fontFamily, fontStyle, size);
447
+ break;
448
+
449
+ default:
450
+ metrics = this.getHelveticaMetrics(PdfFontFamily.Helvetica, fontStyle, size);
451
+ break;
452
+ }
453
+
454
+ metrics.name = fontFamily.toString();
455
+ metrics.subScriptSizeFactor = this.subSuperScriptFactor;
456
+ metrics.superscriptSizeFactor = this.subSuperScriptFactor;
457
+ return metrics;
458
+ }
459
+
460
+ // Implementation
461
+ /**
462
+ * Creates `Helvetica font metrics`.
463
+ * @private
464
+ */
465
+ private static getHelveticaMetrics(fontFamily : PdfFontFamily, fontStyle : PdfFontStyle,
466
+ size : number) : PdfFontMetrics {
467
+ let metrics : PdfFontMetrics = new PdfFontMetrics();
468
+ if ((fontStyle & PdfFontStyle.Bold) > 0 && (fontStyle & PdfFontStyle.Italic) > 0) {
469
+ metrics.ascent = this.helveticaBoldItalicAscent;
470
+ metrics.descent = this.helveticaBoldItalicDescent;
471
+ metrics.postScriptName = this.helveticaBoldItalicName;
472
+ metrics.size = size;
473
+ metrics.widthTable = new StandardWidthTable(this.arialBoldWidth);
474
+ metrics.height = metrics.ascent - metrics.descent;
475
+ } else if ((fontStyle & PdfFontStyle.Bold) > 0) {
476
+ metrics.ascent = this.helveticaBoldAscent;
477
+ metrics.descent = this.helveticaBoldDescent;
478
+ metrics.postScriptName = this.helveticaBoldName;
479
+ metrics.size = size;
480
+ metrics.widthTable = new StandardWidthTable(this.arialBoldWidth);
481
+ metrics.height = metrics.ascent - metrics.descent;
482
+ } else if ((fontStyle & PdfFontStyle.Italic) > 0) {
483
+ metrics.ascent = this.helveticaItalicAscent;
484
+ metrics.descent = this.helveticaItalicDescent;
485
+ metrics.postScriptName = this.helveticaItalicName;
486
+ metrics.size = size;
487
+ metrics.widthTable = new StandardWidthTable(this.arialWidth);
488
+ metrics.height = metrics.ascent - metrics.descent;
489
+ } else {
490
+ metrics.ascent = this.helveticaAscent;
491
+ metrics.descent = this.helveticaDescent;
492
+ metrics.postScriptName = this.helveticaName;
493
+ metrics.size = size;
494
+ metrics.widthTable = new StandardWidthTable(this.arialWidth);
495
+ metrics.height = metrics.ascent - metrics.descent;
496
+ }
497
+
498
+ return metrics;
499
+ }
500
+ /**
501
+ * Creates `Courier font metrics`.
502
+ * @private
503
+ */
504
+ private static getCourierMetrics(fontFamily : PdfFontFamily, fontStyle : PdfFontStyle,
505
+ size : number) : PdfFontMetrics {
506
+ let metrics : PdfFontMetrics = new PdfFontMetrics();
507
+ if ((fontStyle & PdfFontStyle.Bold) > 0 && (fontStyle & PdfFontStyle.Italic) > 0) {
508
+ metrics.ascent = this.courierBoldItalicAscent;
509
+ metrics.descent = this.courierBoldItalicDescent;
510
+ metrics.postScriptName = this.courierBoldItalicName;
511
+ metrics.size = size;
512
+ metrics.widthTable = new StandardWidthTable(this.fixedWidth);
513
+ metrics.height = metrics.ascent - metrics.descent;
514
+ } else if ((fontStyle & PdfFontStyle.Bold) > 0) {
515
+ metrics.ascent = this.courierBoldAscent;
516
+ metrics.descent = this.courierBoldDescent;
517
+ metrics.postScriptName = this.courierBoldName;
518
+ metrics.size = size;
519
+ metrics.widthTable = new StandardWidthTable(this.fixedWidth);
520
+ metrics.height = metrics.ascent - metrics.descent;
521
+ } else if ((fontStyle & PdfFontStyle.Italic) > 0) {
522
+ metrics.ascent = this.courierItalicAscent;
523
+ metrics.descent = this.courierItalicDescent;
524
+ metrics.postScriptName = this.courierItalicName;
525
+ metrics.size = size;
526
+ metrics.widthTable = new StandardWidthTable(this.fixedWidth);
527
+ metrics.height = metrics.ascent - metrics.descent;
528
+ } else {
529
+ metrics.ascent = this.courierAscent;
530
+ metrics.descent = this.courierDescent;
531
+ metrics.postScriptName = this.courierName;
532
+ metrics.size = size;
533
+ metrics.widthTable = new StandardWidthTable(this.fixedWidth);
534
+ metrics.height = metrics.ascent - metrics.descent;
535
+ }
536
+
537
+ return metrics;
538
+ }
539
+ /**
540
+ * Creates `Times font metrics`.
541
+ * @private
542
+ */
543
+ private static getTimesMetrics(fontFamily : PdfFontFamily, fontStyle : PdfFontStyle, size : number) : PdfFontMetrics {
544
+ let metrics : PdfFontMetrics = new PdfFontMetrics();
545
+ if ((fontStyle & PdfFontStyle.Bold) > 0 && (fontStyle & PdfFontStyle.Italic) > 0) {
546
+ metrics.ascent = this.timesBoldItalicAscent;
547
+ metrics.descent = this.timesBoldItalicDescent;
548
+ metrics.postScriptName = this.timesBoldItalicName;
549
+ metrics.size = size;
550
+ metrics.widthTable = new StandardWidthTable(this.timesRomanBoldItalicWidths);
551
+ metrics.height = metrics.ascent - metrics.descent;
552
+ } else if ((fontStyle & PdfFontStyle.Bold) > 0) {
553
+ metrics.ascent = this.timesBoldAscent;
554
+ metrics.descent = this.timesBoldDescent;
555
+ metrics.postScriptName = this.timesBoldName;
556
+ metrics.size = size;
557
+ metrics.widthTable = new StandardWidthTable(this.timesRomanBoldWidth);
558
+ metrics.height = metrics.ascent - metrics.descent;
559
+ } else if ((fontStyle & PdfFontStyle.Italic) > 0) {
560
+ metrics.ascent = this.timesItalicAscent;
561
+ metrics.descent = this.timesItalicDescent;
562
+ metrics.postScriptName = this.timesItalicName;
563
+ metrics.size = size;
564
+ metrics.widthTable = new StandardWidthTable(this.timesRomanItalicWidth);
565
+ metrics.height = metrics.ascent - metrics.descent;
566
+ } else {
567
+ metrics.ascent = this.timesAscent;
568
+ metrics.descent = this.timesDescent;
569
+ metrics.postScriptName = this.timesName;
570
+ metrics.size = size;
571
+ metrics.widthTable = new StandardWidthTable(this.timesRomanWidth);
572
+ metrics.height = metrics.ascent - metrics.descent;
573
+ }
574
+ return metrics;
575
+ }
576
+ /**
577
+ * Creates `Symbol font metrics`.
578
+ * @private
579
+ */
580
+ private static getSymbolMetrics(fontFamily : PdfFontFamily, fontStyle : PdfFontStyle,
581
+ size : number) : PdfFontMetrics {
582
+ let metrics : PdfFontMetrics = new PdfFontMetrics();
583
+ metrics.ascent = this.symbolAscent;
584
+ metrics.descent = this.symbolDescent;
585
+ metrics.postScriptName = this.symbolName;
586
+ metrics.size = size;
587
+ metrics.widthTable = new StandardWidthTable(this.symbolWidth);
588
+ metrics.height = metrics.ascent - metrics.descent;
589
+ return metrics;
590
+ }
591
+ /**
592
+ * Creates `ZapfDingbats font metrics`.
593
+ * @private
594
+ */
595
+ private static getZapfDingbatsMetrics(fontFamily : PdfFontFamily, fontStyle : PdfFontStyle,
596
+ size : number) : PdfFontMetrics {
597
+ let metrics : PdfFontMetrics = new PdfFontMetrics();
598
+ metrics.ascent = this.zapfDingbatsAscent;
599
+ metrics.descent = this.zapfDingbatsDescent;
600
+ metrics.postScriptName = this.zapfDingbatsName;
601
+ metrics.size = size;
602
+ metrics.widthTable = new StandardWidthTable(this.zapfDingbatsWidth);
603
+ metrics.height = metrics.ascent - metrics.descent;
604
+ return metrics;
605
+ }
606
+ }