@syncfusion/ej2-pdf-export 21.2.10 → 22.1.34
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/.eslintrc.json +1 -0
- package/dist/ej2-pdf-export.min.js +1 -1
- package/dist/ej2-pdf-export.umd.min.js +1 -1
- package/dist/global/ej2-pdf-export.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/implementation/actions/action.ts +76 -0
- package/dist/ts/implementation/actions/uri-action.ts +52 -0
- package/dist/ts/implementation/annotations/action-link-annotation.ts +43 -0
- package/dist/ts/implementation/annotations/annotation-collection.ts +159 -0
- package/dist/ts/implementation/annotations/annotation.ts +241 -0
- package/dist/ts/implementation/annotations/document-link-annotation.ts +118 -0
- package/dist/ts/implementation/annotations/link-annotation.ts +32 -0
- package/dist/ts/implementation/annotations/pdf-text-web-link.ts +265 -0
- package/dist/ts/implementation/annotations/uri-annotation.ts +86 -0
- package/dist/ts/implementation/collections/dictionary.ts +150 -0
- package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +125 -0
- package/dist/ts/implementation/collections/utils.ts +38 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +39 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +108 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +127 -0
- package/dist/ts/implementation/document/automatic-fields/composite-field.ts +76 -0
- package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +37 -0
- package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +75 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +157 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +82 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +60 -0
- package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +48 -0
- package/dist/ts/implementation/document/pdf-catalog.ts +52 -0
- package/dist/ts/implementation/document/pdf-document-base.ts +166 -0
- package/dist/ts/implementation/document/pdf-document-template.ts +310 -0
- package/dist/ts/implementation/document/pdf-document.ts +342 -0
- package/dist/ts/implementation/drawing/pdf-drawing.ts +218 -0
- package/dist/ts/implementation/general/enum.ts +21 -0
- package/dist/ts/implementation/general/functions/pdf-function.ts +66 -0
- package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +62 -0
- package/dist/ts/implementation/general/pdf-cache-collection.ts +97 -0
- package/dist/ts/implementation/general/pdf-collection.ts +41 -0
- package/dist/ts/implementation/general/pdf-destination.ts +170 -0
- package/dist/ts/implementation/graphics/brushes/enum.ts +237 -0
- package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +294 -0
- package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +68 -0
- package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +2438 -0
- package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +295 -0
- package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +311 -0
- package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +406 -0
- package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +290 -0
- package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +107 -0
- package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +304 -0
- package/dist/ts/implementation/graphics/constants.ts +31 -0
- package/dist/ts/implementation/graphics/enum.ts +413 -0
- package/dist/ts/implementation/graphics/figures/arc.ts +133 -0
- package/dist/ts/implementation/graphics/figures/base/draw-element.ts +59 -0
- package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +260 -0
- package/dist/ts/implementation/graphics/figures/base/fill-element.ts +72 -0
- package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +34 -0
- package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +69 -0
- package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +276 -0
- package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +205 -0
- package/dist/ts/implementation/graphics/figures/ellipse-part.ts +76 -0
- package/dist/ts/implementation/graphics/figures/enum.ts +80 -0
- package/dist/ts/implementation/graphics/figures/layout-element.ts +132 -0
- package/dist/ts/implementation/graphics/figures/path.ts +646 -0
- package/dist/ts/implementation/graphics/figures/pdf-template.ts +205 -0
- package/dist/ts/implementation/graphics/figures/rectangle-area.ts +108 -0
- package/dist/ts/implementation/graphics/figures/text-element.ts +445 -0
- package/dist/ts/implementation/graphics/fonts/enum.ts +385 -0
- package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +248 -0
- package/dist/ts/implementation/graphics/fonts/pdf-font.ts +316 -0
- package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +606 -0
- package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +243 -0
- package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +474 -0
- package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +165 -0
- package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +958 -0
- package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +374 -0
- package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +255 -0
- package/dist/ts/implementation/graphics/fonts/string-layouter.ts +617 -0
- package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +275 -0
- package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +206 -0
- package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +18 -0
- package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +18 -0
- package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +14 -0
- package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +35 -0
- package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +94 -0
- package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +56 -0
- package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +10 -0
- package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +14 -0
- package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +106 -0
- package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +58 -0
- package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +33 -0
- package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +22 -0
- package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +42 -0
- package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +1254 -0
- package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +577 -0
- package/dist/ts/implementation/graphics/images/byte-array.ts +137 -0
- package/dist/ts/implementation/graphics/images/image-decoder.ts +439 -0
- package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +110 -0
- package/dist/ts/implementation/graphics/images/pdf-image.ts +132 -0
- package/dist/ts/implementation/graphics/pdf-color.ts +478 -0
- package/dist/ts/implementation/graphics/pdf-graphics.ts +2424 -0
- package/dist/ts/implementation/graphics/pdf-margins.ts +124 -0
- package/dist/ts/implementation/graphics/pdf-pen.ts +370 -0
- package/dist/ts/implementation/graphics/pdf-resources.ts +300 -0
- package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +246 -0
- package/dist/ts/implementation/graphics/pdf-transparency.ts +93 -0
- package/dist/ts/implementation/graphics/unit-convertor.ts +96 -0
- package/dist/ts/implementation/input-output/big-endian-writer.ts +121 -0
- package/dist/ts/implementation/input-output/cross-table.ts +21 -0
- package/dist/ts/implementation/input-output/enum.ts +16 -0
- package/dist/ts/implementation/input-output/pdf-cross-table.ts +524 -0
- package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +515 -0
- package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +194 -0
- package/dist/ts/implementation/input-output/pdf-operators.ts +363 -0
- package/dist/ts/implementation/input-output/pdf-stream-writer.ts +681 -0
- package/dist/ts/implementation/input-output/pdf-writer.ts +88 -0
- package/dist/ts/implementation/pages/enum.ts +201 -0
- package/dist/ts/implementation/pages/page-added-event-arguments.ts +39 -0
- package/dist/ts/implementation/pages/pdf-document-page-collection.ts +180 -0
- package/dist/ts/implementation/pages/pdf-page-base.ts +181 -0
- package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +348 -0
- package/dist/ts/implementation/pages/pdf-page-layer.ts +271 -0
- package/dist/ts/implementation/pages/pdf-page-settings.ts +192 -0
- package/dist/ts/implementation/pages/pdf-page-size.ts +162 -0
- package/dist/ts/implementation/pages/pdf-page-template-element.ts +659 -0
- package/dist/ts/implementation/pages/pdf-page.ts +235 -0
- package/dist/ts/implementation/pages/pdf-section-collection.ts +187 -0
- package/dist/ts/implementation/pages/pdf-section-page-collection.ts +61 -0
- package/dist/ts/implementation/pages/pdf-section-templates.ts +96 -0
- package/dist/ts/implementation/pages/pdf-section.ts +644 -0
- package/dist/ts/implementation/primitives/pdf-array.ts +386 -0
- package/dist/ts/implementation/primitives/pdf-boolean.ts +119 -0
- package/dist/ts/implementation/primitives/pdf-dictionary.ts +513 -0
- package/dist/ts/implementation/primitives/pdf-name.ts +218 -0
- package/dist/ts/implementation/primitives/pdf-number.ts +165 -0
- package/dist/ts/implementation/primitives/pdf-reference.ts +430 -0
- package/dist/ts/implementation/primitives/pdf-stream.ts +336 -0
- package/dist/ts/implementation/primitives/pdf-string.ts +397 -0
- package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +2027 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +1193 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +206 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +470 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +853 -0
- package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +240 -0
- package/dist/ts/implementation/structured-elements/grid/styles/style.ts +424 -0
- package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +16 -0
- package/dist/ts/interfaces/i-pdf-cache.ts +23 -0
- package/dist/ts/interfaces/i-pdf-changable.ts +17 -0
- package/dist/ts/interfaces/i-pdf-clonable.ts +12 -0
- package/dist/ts/interfaces/i-pdf-primitives.ts +45 -0
- package/dist/ts/interfaces/i-pdf-true-type-font.ts +48 -0
- package/dist/ts/interfaces/i-pdf-wrapper.ts +13 -0
- package/dist/ts/interfaces/i-pdf-writer.ts +29 -0
- package/package.json +6 -6
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StringTokenizer.ts class for EJ2-PDF
|
|
3
|
+
* Utility class for working with strings.
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export class StringTokenizer {
|
|
7
|
+
// Constants
|
|
8
|
+
/**
|
|
9
|
+
* `Whitespace` symbol.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
public static readonly whiteSpace : string = ' ';
|
|
13
|
+
/**
|
|
14
|
+
* `tab` symbol.
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
public static readonly tab : string = '\t';
|
|
18
|
+
/**
|
|
19
|
+
* Array of `spaces`.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
public static readonly spaces : string[] = [StringTokenizer.whiteSpace, StringTokenizer.tab];
|
|
23
|
+
/**
|
|
24
|
+
* `Pattern` for WhiteSpace.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private static readonly whiteSpacePattern : string = '^[ \t]+$';
|
|
28
|
+
// Fields
|
|
29
|
+
/**
|
|
30
|
+
* `Text` data.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private text : string;
|
|
34
|
+
/**
|
|
35
|
+
* Current `position`.
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private currentPosition : number = 0;
|
|
39
|
+
// Constructors
|
|
40
|
+
/**
|
|
41
|
+
* Initializes a new instance of the `StringTokenizer` class.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
public constructor(textValue : string) {
|
|
45
|
+
if (textValue == null) {
|
|
46
|
+
throw new Error('ArgumentNullException:text');
|
|
47
|
+
}
|
|
48
|
+
this.text = textValue;
|
|
49
|
+
}
|
|
50
|
+
// Properties
|
|
51
|
+
/**
|
|
52
|
+
* Gets text `length`.
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
public get length() : number {
|
|
56
|
+
return this.text.length;
|
|
57
|
+
}
|
|
58
|
+
public get end() : boolean {
|
|
59
|
+
return (this.currentPosition === this.text.length);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Gets or sets the position.
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
public get position() : number {
|
|
66
|
+
return this.currentPosition;
|
|
67
|
+
}
|
|
68
|
+
public set position(value : number) {
|
|
69
|
+
this.currentPosition = value;
|
|
70
|
+
}
|
|
71
|
+
// Public methods
|
|
72
|
+
/**
|
|
73
|
+
* Returns number of symbols occurred in the text.
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
public static getCharsCount(text : string, symbols : string) : number
|
|
77
|
+
/**
|
|
78
|
+
* Returns number of symbols occurred in the text.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
public static getCharsCount(text : string, symbols : string[]) : number
|
|
82
|
+
public static getCharsCount(text : string, symbols : string|string[]) : number {
|
|
83
|
+
if (typeof symbols === 'string') {
|
|
84
|
+
if (text == null) {
|
|
85
|
+
throw new Error('ArgumentNullException:wholeText');
|
|
86
|
+
}
|
|
87
|
+
let numSymbols : number = 0;
|
|
88
|
+
let curIndex : number = 0;
|
|
89
|
+
for ( ; ; ) {
|
|
90
|
+
curIndex = text.indexOf(symbols, curIndex);
|
|
91
|
+
if (curIndex === -1) {
|
|
92
|
+
break;
|
|
93
|
+
} else {
|
|
94
|
+
numSymbols++;
|
|
95
|
+
curIndex++;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return numSymbols;
|
|
99
|
+
} else {
|
|
100
|
+
if (text == null) {
|
|
101
|
+
throw new Error('ArgumentNullException:text');
|
|
102
|
+
}
|
|
103
|
+
if (symbols == null) {
|
|
104
|
+
throw new Error('ArgumentNullException:symbols');
|
|
105
|
+
}
|
|
106
|
+
let count : number = 0;
|
|
107
|
+
for (let i : number = 0, len : number = text.length; i < len; i++) {
|
|
108
|
+
let ch : string = text[i];
|
|
109
|
+
if (this.contains(symbols, ch)) {
|
|
110
|
+
count++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return count;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Reads line of the text.
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
public readLine() : string {
|
|
121
|
+
let pos : number = this.currentPosition;
|
|
122
|
+
while (pos < this.length) {
|
|
123
|
+
let ch : string = this.text[pos];
|
|
124
|
+
switch (ch) {
|
|
125
|
+
case '\r':
|
|
126
|
+
case '\n': {
|
|
127
|
+
let text : string = this.text.substr(this.currentPosition, pos - this.currentPosition);
|
|
128
|
+
this.currentPosition = pos + 1;
|
|
129
|
+
if (((ch === '\r') && (this.currentPosition < this.length)) && (this.text[this.currentPosition] === '\n')) {
|
|
130
|
+
this.currentPosition++;
|
|
131
|
+
}
|
|
132
|
+
return text;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
pos++;
|
|
136
|
+
}
|
|
137
|
+
// The remaining text.
|
|
138
|
+
if (pos > this.currentPosition) {
|
|
139
|
+
let text2 : string = this.text.substr(this.currentPosition, pos - this.currentPosition);
|
|
140
|
+
this.currentPosition = pos;
|
|
141
|
+
return text2;
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Reads line of the text.
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
public peekLine() : string {
|
|
150
|
+
let pos : number = this.currentPosition;
|
|
151
|
+
let line : string = this.readLine();
|
|
152
|
+
this.currentPosition = pos;
|
|
153
|
+
return line;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Reads a word from the text.
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
public readWord() : string {
|
|
160
|
+
let pos : number = this.currentPosition;
|
|
161
|
+
while (pos < this.length) {
|
|
162
|
+
let ch : string = this.text[pos];
|
|
163
|
+
switch (ch) {
|
|
164
|
+
case '\r':
|
|
165
|
+
case '\n':
|
|
166
|
+
let textValue : string = this.text.substr(this.currentPosition, pos - this.currentPosition);
|
|
167
|
+
this.currentPosition = pos + 1;
|
|
168
|
+
if (((ch === '\r') && (this.currentPosition < this.length)) && (this.text[this.currentPosition] === '\n')) {
|
|
169
|
+
this.currentPosition++;
|
|
170
|
+
}
|
|
171
|
+
return textValue;
|
|
172
|
+
case ' ':
|
|
173
|
+
case '\t': {
|
|
174
|
+
if (pos === this.currentPosition) {
|
|
175
|
+
pos++;
|
|
176
|
+
}
|
|
177
|
+
let text : string = this.text.substr(this.currentPosition, pos - this.currentPosition);
|
|
178
|
+
this.currentPosition = pos;
|
|
179
|
+
return text;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
pos++;
|
|
183
|
+
}
|
|
184
|
+
// The remaining text.
|
|
185
|
+
if (pos > this.currentPosition) {
|
|
186
|
+
let text2 : string = this.text.substr(this.currentPosition, pos - this.currentPosition);
|
|
187
|
+
this.currentPosition = pos;
|
|
188
|
+
return text2;
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Peeks a word from the text.
|
|
194
|
+
* @private
|
|
195
|
+
*/
|
|
196
|
+
public peekWord() : string {
|
|
197
|
+
let pos : number = this.currentPosition;
|
|
198
|
+
let word : string = this.readWord();
|
|
199
|
+
this.currentPosition = pos;
|
|
200
|
+
return word;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Reads char form the data.
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
public read() : string
|
|
207
|
+
/**
|
|
208
|
+
* Reads count of the symbols.
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
public read(count : number) : string
|
|
212
|
+
public read(count ?: number) : string {
|
|
213
|
+
if (typeof count === 'undefined') {
|
|
214
|
+
let ch : string = '0';
|
|
215
|
+
if (!this.end) {
|
|
216
|
+
ch = this.text[this.currentPosition];
|
|
217
|
+
this.currentPosition++;
|
|
218
|
+
}
|
|
219
|
+
return ch;
|
|
220
|
+
} else {
|
|
221
|
+
let num : number = 0;
|
|
222
|
+
let builder : string = '';
|
|
223
|
+
while (!this.end && num < count) {
|
|
224
|
+
let ch : string = this.read();
|
|
225
|
+
builder = builder + ch;
|
|
226
|
+
num++;
|
|
227
|
+
}
|
|
228
|
+
return builder;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Peeks char form the data.
|
|
233
|
+
* @private
|
|
234
|
+
*/
|
|
235
|
+
public peek() : string {
|
|
236
|
+
let ch : string = '0';
|
|
237
|
+
if (!this.end) {
|
|
238
|
+
ch = this.text[this.currentPosition];
|
|
239
|
+
}
|
|
240
|
+
return ch;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Closes a reader.
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
public close() : void {
|
|
247
|
+
this.text = null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
public readToEnd() : string {
|
|
251
|
+
let text : string;
|
|
252
|
+
if (this.currentPosition === 0) {
|
|
253
|
+
text = this.text;
|
|
254
|
+
} else {
|
|
255
|
+
text = this.text.substr(this.currentPosition, this.length - this.currentPosition);
|
|
256
|
+
}
|
|
257
|
+
this.currentPosition = this.length;
|
|
258
|
+
return text;
|
|
259
|
+
}
|
|
260
|
+
//Implementation
|
|
261
|
+
/**
|
|
262
|
+
* Checks whether array contains a symbol.
|
|
263
|
+
* @private
|
|
264
|
+
*/
|
|
265
|
+
private static contains(array : string[], symbol : string) : boolean {
|
|
266
|
+
let contains : boolean = false;
|
|
267
|
+
for (let i : number = 0; i < array.length; i++) {
|
|
268
|
+
if (array[i] === symbol) {
|
|
269
|
+
contains = true;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return contains;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TtfOS2Table.ts class for EJ2-PDF
|
|
3
|
+
* The OS/2 table consists of a set of metrics that are required by Windows and OS/2.
|
|
4
|
+
*/
|
|
5
|
+
export class TtfOS2Table {
|
|
6
|
+
//Fields
|
|
7
|
+
/**
|
|
8
|
+
* Structure field.
|
|
9
|
+
*/
|
|
10
|
+
public version : number;
|
|
11
|
+
/**
|
|
12
|
+
* The Average Character Width parameter specifies
|
|
13
|
+
* the arithmetic average of the escapement (width)
|
|
14
|
+
* of all of the 26 lowercase letters a through z of the Latin alphabet
|
|
15
|
+
* and the space character. If any of the 26 lowercase letters are not present,
|
|
16
|
+
* this parameter should equal the weighted average of all glyphs in the font.
|
|
17
|
+
* For non - U G L (platform 3, encoding 0) fonts, use the unweighted average.
|
|
18
|
+
*/
|
|
19
|
+
public xAvgCharWidth : number;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates the visual weight (degree of blackness or thickness of strokes)
|
|
22
|
+
* of the characters in the font.
|
|
23
|
+
*/
|
|
24
|
+
public usWeightClass : number;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates a relative change from the normal aspect ratio (width to height ratio)
|
|
27
|
+
* as specified by a font designer for the glyphs in a font.
|
|
28
|
+
*/
|
|
29
|
+
public usWidthClass : number;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates font embedding licensing rights for the font.
|
|
32
|
+
* Embeddable fonts may be stored in a document.
|
|
33
|
+
* When a document with embedded fonts is opened on a system that does not have the font installed
|
|
34
|
+
* (the remote system), the embedded font may be loaded for temporary (and in some cases, permanent)
|
|
35
|
+
* use on that system by an embedding-aware application.
|
|
36
|
+
* Embedding licensing rights are granted by the vendor of the font.
|
|
37
|
+
*/
|
|
38
|
+
public fsType : number;
|
|
39
|
+
/**
|
|
40
|
+
* The recommended horizontal size in font design units for subscripts for this font.
|
|
41
|
+
*/
|
|
42
|
+
public ySubscriptXSize : number;
|
|
43
|
+
/**
|
|
44
|
+
* The recommended vertical size in font design units for subscripts for this font.
|
|
45
|
+
*/
|
|
46
|
+
public ySubscriptYSize : number;
|
|
47
|
+
/**
|
|
48
|
+
* The recommended horizontal offset in font design units for subscripts for this font.
|
|
49
|
+
*/
|
|
50
|
+
public ySubscriptXOffset : number;
|
|
51
|
+
/**
|
|
52
|
+
* The recommended vertical offset in font design units from the baseline for subscripts for this font.
|
|
53
|
+
*/
|
|
54
|
+
public ySubscriptYOffset : number;
|
|
55
|
+
/**
|
|
56
|
+
* The recommended horizontal size in font design units for superscripts for this font.
|
|
57
|
+
*/
|
|
58
|
+
public ySuperscriptXSize : number;
|
|
59
|
+
/**
|
|
60
|
+
* The recommended vertical size in font design units for superscripts for this font.
|
|
61
|
+
*/
|
|
62
|
+
public ySuperscriptYSize : number;
|
|
63
|
+
/**
|
|
64
|
+
* The recommended horizontal offset in font design units for superscripts for this font.
|
|
65
|
+
*/
|
|
66
|
+
public ySuperscriptXOffset : number;
|
|
67
|
+
/**
|
|
68
|
+
* The recommended vertical offset in font design units from the baseline for superscripts for this font.
|
|
69
|
+
*/
|
|
70
|
+
public ySuperscriptYOffset : number;
|
|
71
|
+
/**
|
|
72
|
+
* Width of the strikeout stroke in font design units.
|
|
73
|
+
*/
|
|
74
|
+
public yStrikeoutSize : number;
|
|
75
|
+
/**
|
|
76
|
+
* The position of the strikeout stroke relative to the baseline in font design units.
|
|
77
|
+
*/
|
|
78
|
+
public yStrikeoutPosition : number;
|
|
79
|
+
/**
|
|
80
|
+
* This parameter is a classification of font-family design.
|
|
81
|
+
*/
|
|
82
|
+
public sFamilyClass : number;
|
|
83
|
+
/**
|
|
84
|
+
* This 10 byte series of numbers are used to describe the visual characteristics
|
|
85
|
+
* of a given typeface. These characteristics are then used to associate the font with
|
|
86
|
+
* other fonts of similar appearance having different names. The variables for each digit are listed below.
|
|
87
|
+
* The specifications for each variable can be obtained in the specification
|
|
88
|
+
* PANOSE v2.0 Numerical Evaluation from Microsoft Corporation.
|
|
89
|
+
*/
|
|
90
|
+
public panose : number[];
|
|
91
|
+
//Microsoft or Elseware Corporation
|
|
92
|
+
/**
|
|
93
|
+
* Structure field.
|
|
94
|
+
*/
|
|
95
|
+
public ulUnicodeRange1 : number;
|
|
96
|
+
/**
|
|
97
|
+
* Structure field.
|
|
98
|
+
*/
|
|
99
|
+
public ulUnicodeRange2 : number;
|
|
100
|
+
/**
|
|
101
|
+
* Structure field.
|
|
102
|
+
*/
|
|
103
|
+
public ulUnicodeRange3 : number;
|
|
104
|
+
/**
|
|
105
|
+
* Structure field.
|
|
106
|
+
*/
|
|
107
|
+
public ulUnicodeRange4 : number;
|
|
108
|
+
/**
|
|
109
|
+
* The four character identifier for the vendor of the given type face.
|
|
110
|
+
*/
|
|
111
|
+
public vendorIdentifier : number[];
|
|
112
|
+
/**
|
|
113
|
+
* Information concerning the nature of the font patterns.
|
|
114
|
+
*/
|
|
115
|
+
public fsSelection : number;
|
|
116
|
+
/**
|
|
117
|
+
* The minimum Unicode index (character code) in this font,
|
|
118
|
+
* according to the cmap subtable for platform ID 3 and encoding ID 0 or 1.
|
|
119
|
+
* For most fonts supporting Win-ANSI or other character sets, this value would be 0x0020.
|
|
120
|
+
*/
|
|
121
|
+
public usFirstCharIndex : number;
|
|
122
|
+
/**
|
|
123
|
+
* usLastCharIndex: The maximum Unicode index (character code) in this font,
|
|
124
|
+
* according to the cmap subtable for platform ID 3 and encoding ID 0 or 1.
|
|
125
|
+
* This value depends on which character sets the font supports.
|
|
126
|
+
*/
|
|
127
|
+
public usLastCharIndex : number;
|
|
128
|
+
/**
|
|
129
|
+
* The typographic ascender for this font.
|
|
130
|
+
* Remember that this is not the same as the Ascender value in the 'h h e a' table,
|
|
131
|
+
* which Apple defines in a far different manner.
|
|
132
|
+
* DEF_TABLE_OFFSET good source for usTypoAscender is the Ascender value from an A F M file.
|
|
133
|
+
*/
|
|
134
|
+
public sTypoAscender : number;
|
|
135
|
+
/**
|
|
136
|
+
* The typographic descender for this font.
|
|
137
|
+
* Remember that this is not the same as the Descender value in the 'h h e a' table,
|
|
138
|
+
* which Apple defines in a far different manner.
|
|
139
|
+
* DEF_TABLE_OFFSET good source for usTypoDescender is the Descender value from an A F M file.
|
|
140
|
+
*/
|
|
141
|
+
public sTypoDescender : number;
|
|
142
|
+
/**
|
|
143
|
+
* The typographic line gap for this font.
|
|
144
|
+
* Remember that this is not the same as the LineGap value in the 'h h e a' table,
|
|
145
|
+
* which Apple defines in a far different manner.
|
|
146
|
+
*/
|
|
147
|
+
public sTypoLineGap : number;
|
|
148
|
+
/**
|
|
149
|
+
* The ascender metric for Windows.
|
|
150
|
+
* This too is distinct from Apple's Ascender value and from the usTypoAscender values.
|
|
151
|
+
* usWinAscent is computed as the yMax for all characters in the Windows ANSI character set.
|
|
152
|
+
* usTypoAscent is used to compute the Windows font height and default line spacing.
|
|
153
|
+
* For platform 3 encoding 0 fonts, it is the same as yMax.
|
|
154
|
+
*/
|
|
155
|
+
public usWinAscent : number;
|
|
156
|
+
/**
|
|
157
|
+
* The descender metric for Windows.
|
|
158
|
+
* This too is distinct from Apple's Descender value and from the usTypoDescender values.
|
|
159
|
+
* usWinDescent is computed as the -yMin for all characters in the Windows ANSI character set.
|
|
160
|
+
* usTypoAscent is used to compute the Windows font height and default line spacing.
|
|
161
|
+
* For platform 3 encoding 0 fonts, it is the same as -yMin.
|
|
162
|
+
*/
|
|
163
|
+
public usWinDescent : number;
|
|
164
|
+
/**
|
|
165
|
+
* This field is used to specify the code pages encompassed
|
|
166
|
+
* by the font file in the 'cmap' subtable for platform 3, encoding ID 1 (Microsoft platform).
|
|
167
|
+
* If the font file is encoding ID 0, then the Symbol Character Set bit should be set.
|
|
168
|
+
* If the bit is set (1) then the code page is considered functional.
|
|
169
|
+
* If the bit is clear (0) then the code page is not considered functional.
|
|
170
|
+
* Each of the bits is treated as an independent flag and the bits can be set in any combination.
|
|
171
|
+
* The determination of "functional" is left up to the font designer,
|
|
172
|
+
* although character set selection should attempt to be functional by code pages if at all possible.
|
|
173
|
+
*/
|
|
174
|
+
public ulCodePageRange1 : number;
|
|
175
|
+
/**
|
|
176
|
+
* This field is used to specify the code pages encompassed
|
|
177
|
+
* by the font file in the 'cmap' subtable for platform 3, encoding ID 1 (Microsoft platform).
|
|
178
|
+
* If the font file is encoding ID 0, then the Symbol Character Set bit should be set.
|
|
179
|
+
* If the bit is set (1) then the code page is considered functional.
|
|
180
|
+
* If the bit is clear (0) then the code page is not considered functional.
|
|
181
|
+
* Each of the bits is treated as an independent flag and the bits can be set in any combination.
|
|
182
|
+
* The determination of "functional" is left up to the font designer,
|
|
183
|
+
* although character set selection should attempt to be functional by code pages if at all possible.
|
|
184
|
+
*/
|
|
185
|
+
public ulCodePageRange2 : number;
|
|
186
|
+
/**
|
|
187
|
+
* Structure field.
|
|
188
|
+
*/
|
|
189
|
+
public sxHeight : number;
|
|
190
|
+
/**
|
|
191
|
+
* Structure field.
|
|
192
|
+
*/
|
|
193
|
+
public sCapHeight : number;
|
|
194
|
+
/**
|
|
195
|
+
* Structure field.
|
|
196
|
+
*/
|
|
197
|
+
public usDefaultChar : number;
|
|
198
|
+
/**
|
|
199
|
+
* Structure field.
|
|
200
|
+
*/
|
|
201
|
+
public usBreakChar : number;
|
|
202
|
+
/**
|
|
203
|
+
* Structure field.
|
|
204
|
+
*/
|
|
205
|
+
public usMaxContext : number;
|
|
206
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TtfAppleCmapSubTable.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
export class TtfAppleCmapSubTable {
|
|
5
|
+
//Fields
|
|
6
|
+
/**
|
|
7
|
+
* Structure field.
|
|
8
|
+
*/
|
|
9
|
+
public format : number;
|
|
10
|
+
/**
|
|
11
|
+
* Structure field.
|
|
12
|
+
*/
|
|
13
|
+
public length : number;
|
|
14
|
+
/**
|
|
15
|
+
* Structure field.
|
|
16
|
+
*/
|
|
17
|
+
public version : number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TtfCmapSubTable.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
export class TtfCmapSubTable {
|
|
5
|
+
//Fields
|
|
6
|
+
/**
|
|
7
|
+
* Structure field.
|
|
8
|
+
*/
|
|
9
|
+
public platformID : number;
|
|
10
|
+
/**
|
|
11
|
+
* Structure field.
|
|
12
|
+
*/
|
|
13
|
+
public encodingID : number;
|
|
14
|
+
/**
|
|
15
|
+
* Structure field.
|
|
16
|
+
*/
|
|
17
|
+
public offset : number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TtfLocaTable.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
export class TtfGlyphHeader {
|
|
5
|
+
//Fields
|
|
6
|
+
/**
|
|
7
|
+
* Structure field.
|
|
8
|
+
*/
|
|
9
|
+
public numberOfContours : number;
|
|
10
|
+
/**
|
|
11
|
+
* Structure field.
|
|
12
|
+
*/
|
|
13
|
+
public xMin : number;
|
|
14
|
+
/**
|
|
15
|
+
* Structure field.
|
|
16
|
+
*/
|
|
17
|
+
public yMin : number;
|
|
18
|
+
/**
|
|
19
|
+
* Structure field.
|
|
20
|
+
*/
|
|
21
|
+
public xMax : number;
|
|
22
|
+
/**
|
|
23
|
+
* Structure field.
|
|
24
|
+
*/
|
|
25
|
+
public yMax : number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TtfGlyphInfo.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
export class TtfGlyphInfo {
|
|
5
|
+
//Fields
|
|
6
|
+
/**
|
|
7
|
+
* Holds glyph index.
|
|
8
|
+
*/
|
|
9
|
+
public index : number;
|
|
10
|
+
/**
|
|
11
|
+
* Holds character's width.
|
|
12
|
+
*/
|
|
13
|
+
public width : number;
|
|
14
|
+
/**
|
|
15
|
+
* Code of the char symbol.
|
|
16
|
+
*/
|
|
17
|
+
public charCode : number;
|
|
18
|
+
|
|
19
|
+
//Properties
|
|
20
|
+
/**
|
|
21
|
+
* Gets a value indicating whether this TtfGlyphInfo is empty.
|
|
22
|
+
*/
|
|
23
|
+
public get empty() : boolean {
|
|
24
|
+
let empty : boolean = (this.index === this.width && this.width === this.charCode && this.charCode === 0);
|
|
25
|
+
return empty;
|
|
26
|
+
}
|
|
27
|
+
//IComparable implementation
|
|
28
|
+
/**
|
|
29
|
+
* Compares two WidthDescriptor objects.
|
|
30
|
+
*/
|
|
31
|
+
public compareTo(obj : Object) : number {
|
|
32
|
+
let glyph : TtfGlyphInfo = obj as TtfGlyphInfo;
|
|
33
|
+
return this.index - glyph.index;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TtfHeadTable.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
export class TtfHeadTable {
|
|
5
|
+
/**
|
|
6
|
+
* Modified: International date (8-byte field).
|
|
7
|
+
*/
|
|
8
|
+
public modified : number;
|
|
9
|
+
/**
|
|
10
|
+
* Created: International date (8-byte field).
|
|
11
|
+
*/
|
|
12
|
+
public created : number;
|
|
13
|
+
/**
|
|
14
|
+
* MagicNumber: Set to 0x5F0F3CF5.
|
|
15
|
+
*/
|
|
16
|
+
public magicNumber : number;
|
|
17
|
+
/**
|
|
18
|
+
* CheckSumAdjustment: To compute: set it to 0, sum the entire font as U Long,
|
|
19
|
+
* then store 0x B 1 B 0 A F B A - sum.
|
|
20
|
+
*/
|
|
21
|
+
public checkSumAdjustment : number;
|
|
22
|
+
/**
|
|
23
|
+
* FontRevision: Set by font manufacturer.
|
|
24
|
+
*/
|
|
25
|
+
public fontRevision : number;
|
|
26
|
+
/**
|
|
27
|
+
* Table version number: 0x00010000 for version 1.0.
|
|
28
|
+
*/
|
|
29
|
+
public version : number;
|
|
30
|
+
/**
|
|
31
|
+
* Minimum x for all glyph bounding boxes.
|
|
32
|
+
*/
|
|
33
|
+
public xMin : number;
|
|
34
|
+
/**
|
|
35
|
+
* Minimum y for all glyph bounding boxes.
|
|
36
|
+
*/
|
|
37
|
+
public yMin : number;
|
|
38
|
+
/**
|
|
39
|
+
* Valid range is from 16 to 16384.
|
|
40
|
+
*/
|
|
41
|
+
public unitsPerEm : number;
|
|
42
|
+
/**
|
|
43
|
+
* Maximum y for all glyph bounding boxes.
|
|
44
|
+
*/
|
|
45
|
+
public yMax : number;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum x for all glyph bounding boxes.
|
|
48
|
+
*/
|
|
49
|
+
public xMax : number;
|
|
50
|
+
/**
|
|
51
|
+
* Regular: 0
|
|
52
|
+
* Bold: 1
|
|
53
|
+
* Italic: 2
|
|
54
|
+
* Bold Italic: 3
|
|
55
|
+
* Bit 0 - bold (if set to 1)
|
|
56
|
+
* Bit 1 - italic (if set to 1)
|
|
57
|
+
* Bits 2-15 - reserved (set to 0)
|
|
58
|
+
* NOTE:
|
|
59
|
+
* Note that macStyle bits must agree with the 'OS/2' table fsSelection bits.
|
|
60
|
+
* The fsSelection bits are used over the macStyle bits in Microsoft Windows.
|
|
61
|
+
* The PANOSE values and 'post' table values are ignored for determining bold or italic fonts.
|
|
62
|
+
*/
|
|
63
|
+
public macStyle : number;
|
|
64
|
+
/**
|
|
65
|
+
* Bit 0 - baseline for font at y=0
|
|
66
|
+
* Bit 1 - left SideBearing at x=0
|
|
67
|
+
* Bit 2 - instructions may depend on point size
|
|
68
|
+
* Bit 3 - force p p e m to integer values for all private scaler math; may use fractional p p e m sizes if this bit is clean
|
|
69
|
+
* Bit 4 - instructions may alter advance width (the advance widths might not scale linearly)
|
|
70
|
+
* Note: All other bits must be zero.
|
|
71
|
+
*/
|
|
72
|
+
public flags : number;
|
|
73
|
+
/**
|
|
74
|
+
* lowestReadableSize: Smallest readable size in pixels.
|
|
75
|
+
*/
|
|
76
|
+
public lowestReadableSize : number;
|
|
77
|
+
/**
|
|
78
|
+
* FontDirectionHint:
|
|
79
|
+
* 0 Fully mixed directional glyphs
|
|
80
|
+
* 1 Only strongly left to right
|
|
81
|
+
* 2 Like 1 but also contains neutrals
|
|
82
|
+
* -1 Only strongly right to left
|
|
83
|
+
* -2 Like -1 but also contains neutrals.
|
|
84
|
+
*/
|
|
85
|
+
public fontDirectionHint : number;
|
|
86
|
+
/**
|
|
87
|
+
* 0 for short offsets, 1 for long.
|
|
88
|
+
*/
|
|
89
|
+
public indexToLocalFormat : number;
|
|
90
|
+
/**
|
|
91
|
+
* 0 for current format.
|
|
92
|
+
*/
|
|
93
|
+
public glyphDataFormat : number;
|
|
94
|
+
}
|