@flighthq/bitmaptext 0.5.1-next.704.19c91ec → 0.5.1-next.730.f29a5aa
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 +8 -8
- package/src/bitmapText.test.ts +3 -3
- package/src/updateBitmapText.test.ts +6 -6
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/bitmaptext`. 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/bitmaptext@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/bitmaptext@0.5.1-next.730.f29a5aa](https://github.com/flighthq/flight/tree/f29a5aab5db192284ce5cadf08ffae2649a598ea/packages/bitmaptext)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/f29a5aab5db192284ce5cadf08ffae2649a598ea/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/bitmaptext",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.730.f29a5aa",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/scene2d": "0.5.1-next.
|
|
42
|
-
"@flighthq/geometry": "0.5.1-next.
|
|
43
|
-
"@flighthq/log": "0.5.1-next.
|
|
44
|
-
"@flighthq/node": "0.5.1-next.
|
|
45
|
-
"@flighthq/texture": "0.5.1-next.
|
|
46
|
-
"@flighthq/textureatlas": "0.5.1-next.
|
|
47
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/scene2d": "0.5.1-next.730.f29a5aa",
|
|
42
|
+
"@flighthq/geometry": "0.5.1-next.730.f29a5aa",
|
|
43
|
+
"@flighthq/log": "0.5.1-next.730.f29a5aa",
|
|
44
|
+
"@flighthq/node": "0.5.1-next.730.f29a5aa",
|
|
45
|
+
"@flighthq/texture": "0.5.1-next.730.f29a5aa",
|
|
46
|
+
"@flighthq/textureatlas": "0.5.1-next.730.f29a5aa",
|
|
47
|
+
"@flighthq/types": "0.5.1-next.730.f29a5aa"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@flighthq/glyphatlas": "*",
|
package/src/bitmapText.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRectangle } from '@flighthq/geometry/contract';
|
|
2
2
|
import { getNode2DRuntime } from '@flighthq/scene2d/contract';
|
|
3
|
-
import type { BitmapTextRuntime, GlyphEntry, GlyphSource,
|
|
3
|
+
import type { BitmapTextRuntime, GlyphEntry, GlyphSource, ImageResource } from '@flighthq/types/contract';
|
|
4
4
|
import { BitmapTextKind } from '@flighthq/types/contract';
|
|
5
5
|
import { describe, expect, it } from 'vitest';
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from './bitmapText';
|
|
23
23
|
import { updateBitmapText } from './updateBitmapText';
|
|
24
24
|
|
|
25
|
-
// A single-page glyph source: A/B are 6x8, a space advances 5, and page 0 is a stub `
|
|
25
|
+
// A single-page glyph source: A/B are 6x8, a space advances 5, and page 0 is a stub `ImageResource`.
|
|
26
26
|
function createTestGlyphSource(): GlyphSource {
|
|
27
27
|
const entries = new Map<number, GlyphEntry>();
|
|
28
28
|
const add = (cp: number, x: number): void => {
|
|
@@ -31,7 +31,7 @@ function createTestGlyphSource(): GlyphSource {
|
|
|
31
31
|
add(0x41, 0); // A
|
|
32
32
|
add(0x42, 6); // B
|
|
33
33
|
entries.set(0x20, { advance: 5, bearingX: 0, bearingY: 0, height: 0, page: 0, width: 0, x: 0, y: 0 }); // space
|
|
34
|
-
const image = {} as
|
|
34
|
+
const image = {} as ImageResource;
|
|
35
35
|
return {
|
|
36
36
|
getGlyphAtlasImage: (page = 0) => (page === 0 ? image : null),
|
|
37
37
|
getGlyphEntry: (cp) => entries.get(cp) ?? null,
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
GlyphEntry,
|
|
13
13
|
GlyphRasterizerBackend,
|
|
14
14
|
GlyphSource,
|
|
15
|
-
|
|
15
|
+
ImageResource,
|
|
16
16
|
} from '@flighthq/types/contract';
|
|
17
17
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
18
18
|
|
|
@@ -31,7 +31,7 @@ function createTestGlyphSource(): GlyphSource {
|
|
|
31
31
|
add(0x42, 6); // B
|
|
32
32
|
entries.set(0x20, { advance: 5, bearingX: 0, bearingY: 0, height: 0, page: 0, width: 0, x: 0, y: 0 }); // space
|
|
33
33
|
const kerning = new Map<number, number>([[(0x41 << 16) | 0x42, -2]]);
|
|
34
|
-
const image = {} as
|
|
34
|
+
const image = {} as ImageResource;
|
|
35
35
|
return {
|
|
36
36
|
getGlyphAtlasImage: (page = 0) => (page === 0 ? image : null),
|
|
37
37
|
getGlyphEntry: (cp) => entries.get(cp) ?? null,
|
|
@@ -42,9 +42,9 @@ function createTestGlyphSource(): GlyphSource {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// A two-page glyph source: 'A' lives on page 0, 'B' on page 1, each page a DISTINCT stub image.
|
|
45
|
-
function createTwoPageGlyphSource(): { source: GlyphSource; page0Image:
|
|
46
|
-
const page0Image = {} as
|
|
47
|
-
const page1Image = {} as
|
|
45
|
+
function createTwoPageGlyphSource(): { source: GlyphSource; page0Image: ImageResource; page1Image: ImageResource } {
|
|
46
|
+
const page0Image = {} as ImageResource;
|
|
47
|
+
const page1Image = {} as ImageResource;
|
|
48
48
|
const entries = new Map<number, GlyphEntry>([
|
|
49
49
|
[0x41, { advance: 10, bearingX: 0, bearingY: 8, height: 8, page: 0, width: 6, x: 0, y: 0 }], // A → page 0
|
|
50
50
|
[0x42, { advance: 10, bearingX: 0, bearingY: 8, height: 8, page: 1, width: 6, x: 3, y: 0 }], // B → page 1
|
|
@@ -91,7 +91,7 @@ function readGlyphCodepointAtRegion(bitmap: Readonly<Bitmap>, x: number, y: numb
|
|
|
91
91
|
// that DROPS a glyph: the reference the pass captured is orphaned at its old rect, and the next lookup
|
|
92
92
|
// mints a fresh entry somewhere else. `nth: 0` never fires, for the held-still half of the pair.
|
|
93
93
|
function createMidLayoutRelocatingGlyphSource(nth: number): GlyphSource {
|
|
94
|
-
const image = {} as
|
|
94
|
+
const image = {} as ImageResource;
|
|
95
95
|
const entries = new Map<number, GlyphEntry>();
|
|
96
96
|
for (let codepoint = 0x41; codepoint <= 0x5a; codepoint++) {
|
|
97
97
|
entries.set(codepoint, { advance: 10, bearingX: 0, bearingY: 8, height: 8, page: 0, width: 6, x: 0, y: 0 });
|