@pdfme/common 2.2.1 → 3.0.0-beta.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.
- package/dist/cjs/__tests__/helper.test.js +292 -233
- package/dist/cjs/__tests__/helper.test.js.map +1 -1
- package/dist/cjs/src/constants.js +3 -17
- package/dist/cjs/src/constants.js.map +1 -1
- package/dist/cjs/src/helper.js +72 -99
- package/dist/cjs/src/helper.js.map +1 -1
- package/dist/cjs/src/index.js +7 -37
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/schema.js +17 -71
- package/dist/cjs/src/schema.js.map +1 -1
- package/dist/cjs/src/types.js +3 -0
- package/dist/cjs/src/types.js.map +1 -0
- package/dist/esm/__tests__/helper.test.js +270 -234
- package/dist/esm/__tests__/helper.test.js.map +1 -1
- package/dist/esm/src/constants.js +2 -16
- package/dist/esm/src/constants.js.map +1 -1
- package/dist/esm/src/helper.js +68 -98
- package/dist/esm/src/helper.js.map +1 -1
- package/dist/esm/src/index.js +3 -6
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/schema.js +14 -68
- package/dist/esm/src/schema.js.map +1 -1
- package/dist/esm/src/types.js +2 -0
- package/dist/esm/src/types.js.map +1 -0
- package/dist/types/src/constants.d.ts +2 -16
- package/dist/types/src/helper.d.ts +11 -2
- package/dist/types/src/index.d.ts +5 -8
- package/dist/types/src/schema.d.ts +696 -3574
- package/dist/types/src/types.d.ts +127 -0
- package/package.json +5 -11
- package/src/constants.ts +2 -18
- package/src/helper.ts +108 -116
- package/src/index.ts +28 -87
- package/src/schema.ts +18 -84
- package/src/types.ts +124 -0
- package/tsconfig.cjs.json +3 -2
- package/tsconfig.esm.json +3 -2
- package/dist/cjs/__tests__/barcode.test.js +0 -107
- package/dist/cjs/__tests__/barcode.test.js.map +0 -1
- package/dist/cjs/__tests__/font.test.js +0 -465
- package/dist/cjs/__tests__/font.test.js.map +0 -1
- package/dist/cjs/src/barcode.js +0 -53
- package/dist/cjs/src/barcode.js.map +0 -1
- package/dist/cjs/src/font.js +0 -310
- package/dist/cjs/src/font.js.map +0 -1
- package/dist/cjs/src/type.js +0 -12
- package/dist/cjs/src/type.js.map +0 -1
- package/dist/esm/__tests__/barcode.test.js +0 -102
- package/dist/esm/__tests__/barcode.test.js.map +0 -1
- package/dist/esm/__tests__/font.test.js +0 -440
- package/dist/esm/__tests__/font.test.js.map +0 -1
- package/dist/esm/src/barcode.js +0 -44
- package/dist/esm/src/barcode.js.map +0 -1
- package/dist/esm/src/font.js +0 -274
- package/dist/esm/src/font.js.map +0 -1
- package/dist/esm/src/type.js +0 -6
- package/dist/esm/src/type.js.map +0 -1
- package/dist/types/__tests__/barcode.test.d.ts +0 -1
- package/dist/types/__tests__/font.test.d.ts +0 -1
- package/dist/types/src/barcode.d.ts +0 -19
- package/dist/types/src/font.d.ts +0 -34
- package/dist/types/src/type.d.ts +0 -81
- package/src/barcode.ts +0 -51
- package/src/font.ts +0 -352
- package/src/type.ts +0 -69
@@ -1,440 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import { readFileSync } from 'fs';
|
11
|
-
import * as path from 'path';
|
12
|
-
import { calculateDynamicFontSize, checkFont, getBrowserVerticalFontAdjustments, getDefaultFont, getFontDescentInPt, getFontKitFont, getSplittedLines, } from '../src/font';
|
13
|
-
import { BLANK_PDF } from '../src';
|
14
|
-
const sansData = readFileSync(path.join(__dirname, `/assets/fonts/SauceHanSansJP.ttf`));
|
15
|
-
const serifData = readFileSync(path.join(__dirname, `/assets/fonts/SauceHanSerifJP.ttf`));
|
16
|
-
const getSampleFont = () => ({
|
17
|
-
SauceHanSansJP: { fallback: true, data: sansData },
|
18
|
-
SauceHanSerifJP: { data: serifData },
|
19
|
-
});
|
20
|
-
const getTemplate = () => ({
|
21
|
-
basePdf: BLANK_PDF,
|
22
|
-
schemas: [
|
23
|
-
{
|
24
|
-
a: {
|
25
|
-
type: 'text',
|
26
|
-
fontName: 'SauceHanSansJP',
|
27
|
-
position: { x: 0, y: 0 },
|
28
|
-
width: 100,
|
29
|
-
height: 100,
|
30
|
-
},
|
31
|
-
b: {
|
32
|
-
type: 'text',
|
33
|
-
position: { x: 0, y: 0 },
|
34
|
-
width: 100,
|
35
|
-
height: 100,
|
36
|
-
},
|
37
|
-
},
|
38
|
-
],
|
39
|
-
});
|
40
|
-
const getTextSchema = () => {
|
41
|
-
const textSchema = {
|
42
|
-
position: { x: 0, y: 0 }, type: 'text', fontSize: 14, characterSpacing: 1, width: 50, height: 20
|
43
|
-
};
|
44
|
-
return textSchema;
|
45
|
-
};
|
46
|
-
describe('checkFont test', () => {
|
47
|
-
test('success test: no fontName in Schemas', () => {
|
48
|
-
const _getTemplate = () => ({
|
49
|
-
basePdf: BLANK_PDF,
|
50
|
-
schemas: [
|
51
|
-
{
|
52
|
-
a: {
|
53
|
-
type: 'text',
|
54
|
-
position: { x: 0, y: 0 },
|
55
|
-
width: 100,
|
56
|
-
height: 100,
|
57
|
-
},
|
58
|
-
b: {
|
59
|
-
type: 'text',
|
60
|
-
position: { x: 0, y: 0 },
|
61
|
-
width: 100,
|
62
|
-
height: 100,
|
63
|
-
},
|
64
|
-
},
|
65
|
-
],
|
66
|
-
});
|
67
|
-
try {
|
68
|
-
checkFont({ template: _getTemplate(), font: getSampleFont() });
|
69
|
-
expect.anything();
|
70
|
-
}
|
71
|
-
catch (e) {
|
72
|
-
fail();
|
73
|
-
}
|
74
|
-
});
|
75
|
-
test('success test: fontName in Schemas(fallback font)', () => {
|
76
|
-
try {
|
77
|
-
checkFont({ template: getTemplate(), font: getSampleFont() });
|
78
|
-
expect.anything();
|
79
|
-
}
|
80
|
-
catch (e) {
|
81
|
-
fail();
|
82
|
-
}
|
83
|
-
});
|
84
|
-
test('success test: fontName in Schemas(not fallback font)', () => {
|
85
|
-
const getFont = () => ({
|
86
|
-
SauceHanSansJP: { data: sansData },
|
87
|
-
SauceHanSerifJP: { fallback: true, data: serifData },
|
88
|
-
});
|
89
|
-
try {
|
90
|
-
checkFont({ template: getTemplate(), font: getFont() });
|
91
|
-
expect.anything();
|
92
|
-
}
|
93
|
-
catch (e) {
|
94
|
-
fail();
|
95
|
-
}
|
96
|
-
});
|
97
|
-
test('fail test: no fallback font', () => {
|
98
|
-
const getFont = () => ({
|
99
|
-
SauceHanSansJP: { data: sansData },
|
100
|
-
SauceHanSerifJP: { data: serifData },
|
101
|
-
});
|
102
|
-
try {
|
103
|
-
checkFont({ template: getTemplate(), font: getFont() });
|
104
|
-
fail();
|
105
|
-
}
|
106
|
-
catch (e) {
|
107
|
-
expect(e.message).toEqual('fallback flag is not found in font. true fallback flag must be only one.');
|
108
|
-
}
|
109
|
-
});
|
110
|
-
test('fail test: too many fallback font', () => {
|
111
|
-
const getFont = () => ({
|
112
|
-
SauceHanSansJP: { data: sansData, fallback: true },
|
113
|
-
SauceHanSerifJP: { data: serifData, fallback: true },
|
114
|
-
});
|
115
|
-
try {
|
116
|
-
checkFont({ template: getTemplate(), font: getFont() });
|
117
|
-
fail();
|
118
|
-
}
|
119
|
-
catch (e) {
|
120
|
-
expect(e.message).toEqual('2 fallback flags found in font. true fallback flag must be only one.');
|
121
|
-
}
|
122
|
-
});
|
123
|
-
test('fail test: fontName in Schemas not found in font(single)', () => {
|
124
|
-
const _getTemplate = () => ({
|
125
|
-
basePdf: BLANK_PDF,
|
126
|
-
schemas: [
|
127
|
-
{
|
128
|
-
a: {
|
129
|
-
type: 'text',
|
130
|
-
fontName: 'SauceHanSansJP2',
|
131
|
-
position: { x: 0, y: 0 },
|
132
|
-
width: 100,
|
133
|
-
height: 100,
|
134
|
-
},
|
135
|
-
b: {
|
136
|
-
type: 'text',
|
137
|
-
position: { x: 0, y: 0 },
|
138
|
-
width: 100,
|
139
|
-
height: 100,
|
140
|
-
},
|
141
|
-
},
|
142
|
-
],
|
143
|
-
});
|
144
|
-
try {
|
145
|
-
checkFont({ template: _getTemplate(), font: getSampleFont() });
|
146
|
-
fail();
|
147
|
-
}
|
148
|
-
catch (e) {
|
149
|
-
expect(e.message).toEqual('SauceHanSansJP2 of template.schemas is not found in font.');
|
150
|
-
}
|
151
|
-
});
|
152
|
-
test('fail test: fontName in Schemas not found in font(single)', () => {
|
153
|
-
const _getTemplate = () => ({
|
154
|
-
basePdf: BLANK_PDF,
|
155
|
-
schemas: [
|
156
|
-
{
|
157
|
-
a: {
|
158
|
-
type: 'text',
|
159
|
-
fontName: 'SauceHanSansJP2',
|
160
|
-
position: { x: 0, y: 0 },
|
161
|
-
width: 100,
|
162
|
-
height: 100,
|
163
|
-
},
|
164
|
-
b: {
|
165
|
-
type: 'text',
|
166
|
-
fontName: 'SauceHanSerifJP2',
|
167
|
-
position: { x: 0, y: 0 },
|
168
|
-
width: 100,
|
169
|
-
height: 100,
|
170
|
-
},
|
171
|
-
},
|
172
|
-
],
|
173
|
-
});
|
174
|
-
try {
|
175
|
-
checkFont({ template: _getTemplate(), font: getSampleFont() });
|
176
|
-
fail();
|
177
|
-
}
|
178
|
-
catch (e) {
|
179
|
-
expect(e.message).toEqual('SauceHanSansJP2,SauceHanSerifJP2 of template.schemas is not found in font.');
|
180
|
-
}
|
181
|
-
});
|
182
|
-
});
|
183
|
-
describe('getSplitPosition test with mocked font width calculations', () => {
|
184
|
-
/**
|
185
|
-
* To simplify these tests we mock the widthOfTextAtSize function to return
|
186
|
-
* the length of the text in number of characters.
|
187
|
-
* Therefore, setting the boxWidthInPt to 5 should result in a split after 5 characters.
|
188
|
-
*/
|
189
|
-
let widthOfTextAtSizeSpy;
|
190
|
-
beforeAll(() => {
|
191
|
-
// @ts-ignore
|
192
|
-
widthOfTextAtSizeSpy = jest.spyOn(require('../src/font'), 'widthOfTextAtSize');
|
193
|
-
widthOfTextAtSizeSpy.mockImplementation((text) => {
|
194
|
-
return text.length;
|
195
|
-
});
|
196
|
-
});
|
197
|
-
afterAll(() => {
|
198
|
-
widthOfTextAtSizeSpy.mockRestore();
|
199
|
-
});
|
200
|
-
const mockedFont = {};
|
201
|
-
const mockCalcValues = {
|
202
|
-
font: mockedFont,
|
203
|
-
fontSize: 12,
|
204
|
-
characterSpacing: 1,
|
205
|
-
boxWidthInPt: 5,
|
206
|
-
};
|
207
|
-
it('does not split an empty string', () => {
|
208
|
-
expect(getSplittedLines('', mockCalcValues)).toEqual(['']);
|
209
|
-
});
|
210
|
-
it('does not split a short line', () => {
|
211
|
-
expect(getSplittedLines('a', mockCalcValues)).toEqual(['a']);
|
212
|
-
expect(getSplittedLines('aaaa', mockCalcValues)).toEqual(['aaaa']);
|
213
|
-
});
|
214
|
-
it('splits a line to the nearest previous space', () => {
|
215
|
-
expect(getSplittedLines('aaa bbb', mockCalcValues)).toEqual(['aaa', 'bbb']);
|
216
|
-
});
|
217
|
-
it('splits a line where the split point is on a space', () => {
|
218
|
-
expect(getSplittedLines('aaaaa bbbbb', mockCalcValues)).toEqual(['aaaaa', 'bbbbb']);
|
219
|
-
});
|
220
|
-
it('splits a long line in the middle of a word if too long', () => {
|
221
|
-
expect(getSplittedLines('aaaaaa bbb', mockCalcValues)).toEqual(['aaaaa', 'a bbb']);
|
222
|
-
});
|
223
|
-
it('splits a long line without spaces at exactly 5 chars', () => {
|
224
|
-
expect(getSplittedLines('abcdef', mockCalcValues)).toEqual(['abcde', 'f']);
|
225
|
-
});
|
226
|
-
it('splits a very long line without spaces at exactly 5 chars', () => {
|
227
|
-
expect(getSplittedLines('abcdefghijklmn', mockCalcValues)).toEqual(['abcde', 'fghij', 'klmn']);
|
228
|
-
});
|
229
|
-
it('splits a line with lots of words', () => {
|
230
|
-
expect(getSplittedLines('a b c d e', mockCalcValues)).toEqual(['a b c', 'd e']);
|
231
|
-
});
|
232
|
-
});
|
233
|
-
describe('getSplittedLines test with real font width calculations', () => {
|
234
|
-
const font = getDefaultFont();
|
235
|
-
const baseCalcValues = {
|
236
|
-
fontSize: 12,
|
237
|
-
characterSpacing: 1,
|
238
|
-
boxWidthInPt: 40,
|
239
|
-
};
|
240
|
-
it('should not split a line when the text is shorter than the width', () => {
|
241
|
-
getFontKitFont(getTextSchema(), font).then((fontKitFont) => {
|
242
|
-
const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
|
243
|
-
const result = getSplittedLines('short', fontWidthCalcs);
|
244
|
-
expect(result).toEqual(['short']);
|
245
|
-
});
|
246
|
-
});
|
247
|
-
it('should split a line when the text is longer than the width', () => {
|
248
|
-
getFontKitFont(getTextSchema(), font).then((fontKitFont) => {
|
249
|
-
const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
|
250
|
-
const result = getSplittedLines('this will wrap', fontWidthCalcs);
|
251
|
-
expect(result).toEqual(['this', 'will', 'wrap']);
|
252
|
-
});
|
253
|
-
});
|
254
|
-
it('should split a line in the middle when unspaced text will not fit on a line', () => {
|
255
|
-
getFontKitFont(getTextSchema(), font).then((fontKitFont) => {
|
256
|
-
const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
|
257
|
-
const result = getSplittedLines('thiswillbecut', fontWidthCalcs);
|
258
|
-
expect(result).toEqual(['thiswi', 'llbecu', 't']);
|
259
|
-
});
|
260
|
-
});
|
261
|
-
it('should not split text when it is impossible due to size constraints', () => {
|
262
|
-
getFontKitFont(getTextSchema(), font).then((fontKitFont) => {
|
263
|
-
const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
|
264
|
-
fontWidthCalcs.boxWidthInPt = 2;
|
265
|
-
const result = getSplittedLines('thiswillnotbecut', fontWidthCalcs);
|
266
|
-
expect(result).toEqual(['thiswillnotbecut']);
|
267
|
-
});
|
268
|
-
});
|
269
|
-
});
|
270
|
-
describe('calculateDynamicFontSize with Default font', () => {
|
271
|
-
const font = getDefaultFont();
|
272
|
-
it('should return default font size when dynamicFontSizeSetting is not provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
273
|
-
const textSchema = getTextSchema();
|
274
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value: 'test' });
|
275
|
-
expect(result).toBe(14);
|
276
|
-
}));
|
277
|
-
it('should return default font size when dynamicFontSizeSetting max is less than min', () => __awaiter(void 0, void 0, void 0, function* () {
|
278
|
-
const textSchema = getTextSchema();
|
279
|
-
textSchema.dynamicFontSize = { min: 11, max: 10 };
|
280
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value: 'test' });
|
281
|
-
expect(result).toBe(14);
|
282
|
-
}));
|
283
|
-
it('should calculate a dynamic font size of vertical fit between min and max', () => __awaiter(void 0, void 0, void 0, function* () {
|
284
|
-
const textSchema = getTextSchema();
|
285
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
|
286
|
-
const value = 'test with a length string\n and a new line';
|
287
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
288
|
-
expect(result).toBe(19.25);
|
289
|
-
}));
|
290
|
-
it('should calculate a dynamic font size of horizontal fit between min and max', () => __awaiter(void 0, void 0, void 0, function* () {
|
291
|
-
const textSchema = getTextSchema();
|
292
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'horizontal' };
|
293
|
-
const value = 'test with a length string\n and a new line';
|
294
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
295
|
-
expect(result).toBe(11.25);
|
296
|
-
}));
|
297
|
-
it('should calculate a dynamic font size between min and max regardless of current font size', () => __awaiter(void 0, void 0, void 0, function* () {
|
298
|
-
const textSchema = getTextSchema();
|
299
|
-
textSchema.fontSize = 2;
|
300
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
|
301
|
-
const value = 'test with a length string\n and a new line';
|
302
|
-
let result = yield calculateDynamicFontSize({ textSchema, font, value });
|
303
|
-
expect(result).toBe(19.25);
|
304
|
-
textSchema.fontSize = 40;
|
305
|
-
result = yield calculateDynamicFontSize({ textSchema, font, value });
|
306
|
-
expect(result).toBe(19.25);
|
307
|
-
}));
|
308
|
-
it('should return min font size when content is too big to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
|
309
|
-
const textSchema = getTextSchema();
|
310
|
-
textSchema.width = 10;
|
311
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
|
312
|
-
const value = 'test with a length string\n and a new line';
|
313
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
314
|
-
expect(result).toBe(10);
|
315
|
-
}));
|
316
|
-
it('should return max font size when content is too small to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
|
317
|
-
const textSchema = getTextSchema();
|
318
|
-
textSchema.width = 1000;
|
319
|
-
textSchema.height = 200;
|
320
|
-
textSchema.dynamicFontSize = { min: 10, max: 30 };
|
321
|
-
const value = 'test with a length string\n and a new line';
|
322
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
323
|
-
expect(result).toBe(30);
|
324
|
-
}));
|
325
|
-
it('should not reduce font size below 0', () => __awaiter(void 0, void 0, void 0, function* () {
|
326
|
-
const textSchema = getTextSchema();
|
327
|
-
textSchema.dynamicFontSize = { min: -5, max: 10 };
|
328
|
-
textSchema.width = 4;
|
329
|
-
textSchema.height = 1;
|
330
|
-
const value = 'a very \nlong \nmulti-line \nstring\nto';
|
331
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
332
|
-
expect(result).toBeGreaterThan(0);
|
333
|
-
}));
|
334
|
-
it('should calculate a dynamic font size when a starting font size is passed that is lower than the eventual', () => __awaiter(void 0, void 0, void 0, function* () {
|
335
|
-
const textSchema = getTextSchema();
|
336
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
|
337
|
-
const value = 'test with a length string\n and a new line';
|
338
|
-
const startingFontSize = 18;
|
339
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value, startingFontSize });
|
340
|
-
expect(result).toBe(19.25);
|
341
|
-
}));
|
342
|
-
it('should calculate a dynamic font size when a starting font size is passed that is higher than the eventual', () => __awaiter(void 0, void 0, void 0, function* () {
|
343
|
-
const textSchema = getTextSchema();
|
344
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'horizontal' };
|
345
|
-
const value = 'test with a length string\n and a new line';
|
346
|
-
const startingFontSize = 36;
|
347
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value, startingFontSize });
|
348
|
-
expect(result).toBe(11.25);
|
349
|
-
}));
|
350
|
-
it('should calculate a dynamic font size using vertical fit as a default if no fit provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
351
|
-
const textSchema = getTextSchema();
|
352
|
-
textSchema.dynamicFontSize = { min: 10, max: 30 };
|
353
|
-
const value = 'test with a length string\n and a new line';
|
354
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
355
|
-
expect(result).toBe(19.25);
|
356
|
-
}));
|
357
|
-
});
|
358
|
-
describe('calculateDynamicFontSize with Custom font', () => {
|
359
|
-
const font = getSampleFont();
|
360
|
-
it('should return smaller font size when dynamicFontSizeSetting is provided with horizontal fit', () => __awaiter(void 0, void 0, void 0, function* () {
|
361
|
-
const textSchema = getTextSchema();
|
362
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'horizontal' };
|
363
|
-
const value = 'あいうあいうあい';
|
364
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
365
|
-
expect(result).toBe(16.75);
|
366
|
-
}));
|
367
|
-
it('should return smaller font size when dynamicFontSizeSetting is provided with vertical fit', () => __awaiter(void 0, void 0, void 0, function* () {
|
368
|
-
const textSchema = getTextSchema();
|
369
|
-
textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
|
370
|
-
const value = 'あいうあいうあい';
|
371
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
372
|
-
expect(result).toBe(26);
|
373
|
-
}));
|
374
|
-
it('should return min font size when content is too big to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
|
375
|
-
const textSchema = getTextSchema();
|
376
|
-
textSchema.dynamicFontSize = { min: 20, max: 30 };
|
377
|
-
const value = 'あいうあいうあいうあいうあいうあいうあいうあいうあいう';
|
378
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
379
|
-
expect(result).toBe(20);
|
380
|
-
}));
|
381
|
-
it('should return max font size when content is too small to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
|
382
|
-
const textSchema = getTextSchema();
|
383
|
-
textSchema.dynamicFontSize = { min: 10, max: 30 };
|
384
|
-
const value = 'あ';
|
385
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
386
|
-
expect(result).toBe(30);
|
387
|
-
}));
|
388
|
-
it('should return min font size when content is multi-line with too many lines for the container', () => __awaiter(void 0, void 0, void 0, function* () {
|
389
|
-
const textSchema = getTextSchema();
|
390
|
-
textSchema.dynamicFontSize = { min: 5, max: 20 };
|
391
|
-
const value = 'あ\nいう\nあ\nいう\nあ\nいう\nあ\nいう\nあ\nいう\nあ\nいう';
|
392
|
-
const result = yield calculateDynamicFontSize({ textSchema, font, value });
|
393
|
-
expect(result).toBe(5);
|
394
|
-
}));
|
395
|
-
});
|
396
|
-
describe('getFontDescentInPt test', () => {
|
397
|
-
test('it gets a descent size relative to the font size', () => {
|
398
|
-
expect(getFontDescentInPt({ descent: -400, unitsPerEm: 1000 }, 12)).toBe(-4.800000000000001);
|
399
|
-
expect(getFontDescentInPt({ descent: 54, unitsPerEm: 1000 }, 20)).toBe(1.08);
|
400
|
-
expect(getFontDescentInPt({ descent: -512, unitsPerEm: 2048 }, 54)).toBe(-13.5);
|
401
|
-
});
|
402
|
-
});
|
403
|
-
describe('getBrowserVerticalFontAdjustments test', () => {
|
404
|
-
// Font with a base line-height of 1.349
|
405
|
-
const font = { ascent: 1037, descent: -312, unitsPerEm: 1000 };
|
406
|
-
test('it gets a top adjustment when vertically aligning top', () => {
|
407
|
-
expect(getBrowserVerticalFontAdjustments(font, 12, 1.0, 'top')).toEqual({
|
408
|
-
topAdj: 2.791301999999999,
|
409
|
-
bottomAdj: 0,
|
410
|
-
});
|
411
|
-
expect(getBrowserVerticalFontAdjustments(font, 36, 2.0, 'top')).toEqual({
|
412
|
-
topAdj: 8.373906,
|
413
|
-
bottomAdj: 0,
|
414
|
-
});
|
415
|
-
});
|
416
|
-
test('it gets a bottom adjustment when vertically aligning middle or bottom', () => {
|
417
|
-
expect(getBrowserVerticalFontAdjustments(font, 12, 1.0, 'bottom')).toEqual({
|
418
|
-
topAdj: 0,
|
419
|
-
bottomAdj: 2.791302,
|
420
|
-
});
|
421
|
-
expect(getBrowserVerticalFontAdjustments(font, 12, 1.15, 'middle')).toEqual({
|
422
|
-
topAdj: 0,
|
423
|
-
bottomAdj: 1.5916020000000004,
|
424
|
-
});
|
425
|
-
});
|
426
|
-
test('it does not get a bottom adjustment if the line height exceeds that of the font', () => {
|
427
|
-
expect(getBrowserVerticalFontAdjustments(font, 12, 1.35, 'bottom')).toEqual({
|
428
|
-
topAdj: 0,
|
429
|
-
bottomAdj: 0,
|
430
|
-
});
|
431
|
-
});
|
432
|
-
test('it does not get a bottom adjustment if the font base line-height is 1.0 or less', () => {
|
433
|
-
const thisFont = { ascent: 900, descent: -50, unitsPerEm: 1000 };
|
434
|
-
expect(getBrowserVerticalFontAdjustments(thisFont, 20, 1.0, 'bottom')).toEqual({
|
435
|
-
topAdj: 0,
|
436
|
-
bottomAdj: 0,
|
437
|
-
});
|
438
|
-
});
|
439
|
-
});
|
440
|
-
//# sourceMappingURL=font.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"font.test.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;YAC7E,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;SACb,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/esm/src/barcode.js
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import { b64toUint8Array, } from './helper';
|
11
|
-
import bwipjs from 'bwip-js';
|
12
|
-
/**
|
13
|
-
* The bwip.js lib has a different name for nw7 type barcodes
|
14
|
-
*/
|
15
|
-
export const barCodeType2Bcid = (type) => type === 'nw7' ? 'rationalizedCodabar' : type;
|
16
|
-
/**
|
17
|
-
* Strip hash from the beginning of HTML hex color codes for the bwip.js lib
|
18
|
-
*/
|
19
|
-
export const mapHexColorForBwipJsLib = (color, fallback) => color ? color.replace('#', '') : fallback ? fallback.replace('#', '') : '000000';
|
20
|
-
export const createBarCode = (arg) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
-
const { type, input, width, height, backgroundcolor, barcolor, textcolor } = arg;
|
22
|
-
const bcid = barCodeType2Bcid(type);
|
23
|
-
const includetext = true;
|
24
|
-
const scale = 5;
|
25
|
-
const bwipjsArg = { bcid, text: input, width, height, scale, includetext };
|
26
|
-
if (backgroundcolor)
|
27
|
-
bwipjsArg.backgroundcolor = mapHexColorForBwipJsLib(backgroundcolor);
|
28
|
-
if (barcolor)
|
29
|
-
bwipjsArg.barcolor = mapHexColorForBwipJsLib(barcolor);
|
30
|
-
if (textcolor)
|
31
|
-
bwipjsArg.textcolor = mapHexColorForBwipJsLib(textcolor);
|
32
|
-
let res;
|
33
|
-
if (typeof window !== 'undefined') {
|
34
|
-
const canvas = document.createElement('canvas');
|
35
|
-
bwipjs.toCanvas(canvas, bwipjsArg);
|
36
|
-
const dataUrl = canvas.toDataURL('image/png');
|
37
|
-
res = b64toUint8Array(dataUrl).buffer;
|
38
|
-
}
|
39
|
-
else {
|
40
|
-
res = yield bwipjs.toBuffer(bwipjsArg);
|
41
|
-
}
|
42
|
-
return res;
|
43
|
-
});
|
44
|
-
//# sourceMappingURL=barcode.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"barcode.js","sourceRoot":"","sources":["../../../src/barcode.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,GAAG,MAAM,UAAU,CAAC;AAE5C,OAAO,MAA2B,MAAM,SAAS,CAAC;AAGlD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAiB,EAAE,EAAE,CACpD,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,QAAiB,EAAE,EAAE,CACtF,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAEnF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAO,GAQnC,EAAmB,EAAE;IACpB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,G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