@flighthq/textshaper 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
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/README.md +2 -2
- package/package.json +5 -5
- package/src/textShaperCache.test.ts +17 -11
- package/src/textShaperRun.test.ts +7 -1
- package/src/textShaperSignals.test.ts +11 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/textshaper`. The `@f
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/textshaper@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/textshaper@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/textshaper)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/textshaper",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/log": "0.5.1-next.
|
|
43
|
-
"@flighthq/signals": "0.5.1-next.
|
|
44
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/log": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/signals": "0.5.1-next.905.5fbf787",
|
|
44
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"typescript": "^5.3.0"
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
clearTextShaperCache,
|
|
6
6
|
createTextShaperCache,
|
|
7
7
|
disposeTextShaperCache,
|
|
8
|
+
initializeTextShaperCache,
|
|
8
9
|
shapeTextRunCached,
|
|
9
10
|
} from './textShaperCache';
|
|
10
11
|
|
|
@@ -81,6 +82,22 @@ describe('disposeTextShaperCache', () => {
|
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
84
|
|
|
85
|
+
describe('initializeTextShaperCache', () => {
|
|
86
|
+
it('is the construction initializer of createTextShaperCache', () => {
|
|
87
|
+
expect(typeof initializeTextShaperCache).toBe('function');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
function _hostWithAdvance(advanceWidth: number): HasTextShaper {
|
|
92
|
+
return {
|
|
93
|
+
text: {
|
|
94
|
+
shaper: {
|
|
95
|
+
measureText: () => advanceWidth,
|
|
96
|
+
shapeRun: () => ({ ..._stubRun, advanceWidth }),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
84
101
|
describe('shapeTextRunCached', () => {
|
|
85
102
|
it('keeps cache entries isolated when callers interleave explicit hosts', () => {
|
|
86
103
|
const cache = createTextShaperCache();
|
|
@@ -168,14 +185,3 @@ describe('shapeTextRunCached', () => {
|
|
|
168
185
|
expect(cache._entries.size).toBe(1);
|
|
169
186
|
});
|
|
170
187
|
});
|
|
171
|
-
|
|
172
|
-
function _hostWithAdvance(advanceWidth: number): HasTextShaper {
|
|
173
|
-
return {
|
|
174
|
-
text: {
|
|
175
|
-
shaper: {
|
|
176
|
-
measureText: () => advanceWidth,
|
|
177
|
-
shapeRun: () => ({ ..._stubRun, advanceWidth }),
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
getGlyphExtentsInto,
|
|
14
14
|
getGlyphIndexForCodePoint,
|
|
15
15
|
getGlyphName,
|
|
16
|
+
initializeShapedRun,
|
|
16
17
|
shapeTextRun,
|
|
17
18
|
shapeTextRunInto,
|
|
18
19
|
} from './textShaperRun';
|
|
@@ -289,6 +290,12 @@ describe('getGlyphName', () => {
|
|
|
289
290
|
});
|
|
290
291
|
});
|
|
291
292
|
|
|
293
|
+
describe('initializeShapedRun', () => {
|
|
294
|
+
it('is the construction initializer of createShapedRun', () => {
|
|
295
|
+
expect(typeof initializeShapedRun).toBe('function');
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
292
299
|
describe('shapeTextRun', () => {
|
|
293
300
|
it('uses the explicitly supplied host instead of the legacy installed backend', () => {
|
|
294
301
|
setTextShaperBackend({ measureText: () => 0 });
|
|
@@ -326,7 +333,6 @@ describe('shapeTextRun', () => {
|
|
|
326
333
|
expect(capturedOptions).toMatchObject({ direction: 'RightToLeft', script: 'Arab' });
|
|
327
334
|
});
|
|
328
335
|
});
|
|
329
|
-
|
|
330
336
|
describe('shapeTextRunInto', () => {
|
|
331
337
|
it('returns false and does not modify out when no backend is set', () => {
|
|
332
338
|
const out = createShapedRun();
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { TextShaperBackend } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import { setTextShaperBackend } from './textShaper';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
disposeTextShaperSignals,
|
|
6
|
+
enableTextShaperSignals,
|
|
7
|
+
getTextShaperSignals,
|
|
8
|
+
initializeTextShaperSignals,
|
|
9
|
+
} from './textShaperSignals';
|
|
5
10
|
|
|
6
11
|
const _stubBackend: TextShaperBackend = { measureText: () => 0 };
|
|
7
12
|
const _stubBackend2: TextShaperBackend = { measureText: () => 1 };
|
|
@@ -56,6 +61,11 @@ describe('getTextShaperSignals', () => {
|
|
|
56
61
|
});
|
|
57
62
|
});
|
|
58
63
|
|
|
64
|
+
describe('initializeTextShaperSignals', () => {
|
|
65
|
+
it('is the construction initializer of createTextShaperSignals', () => {
|
|
66
|
+
expect(typeof initializeTextShaperSignals).toBe('function');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
59
69
|
describe('setTextShaperBackend', () => {
|
|
60
70
|
it('emits onBackendChanged with the new backend when signals are enabled', () => {
|
|
61
71
|
const sigs = enableTextShaperSignals();
|