@flighthq/bitmapfont 0.5.1-next.597.ab004dd → 0.5.1-next.638.d4dbd4e
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
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/bitmapfont`. 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/bitmapfont@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/bitmapfont@0.5.1-next.638.d4dbd4e](https://github.com/flighthq/flight/tree/d4dbd4e347dc8be10b180c85a766ab50333dcb51/packages/bitmapfont)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/d4dbd4e347dc8be10b180c85a766ab50333dcb51/LICENSE.md)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitmapFontGlyphSource.d.ts","sourceRoot":"","sources":["../src/bitmapFontGlyphSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQxE,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"bitmapFontGlyphSource.d.ts","sourceRoot":"","sources":["../src/bitmapFontGlyphSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQxE,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,WAAW,CAwBvF"}
|
|
@@ -17,6 +17,12 @@ export function createGlyphSourceFromBitmapFont(font) {
|
|
|
17
17
|
getGlyphKerning(left, right) {
|
|
18
18
|
return getBitmapFontKerning(font, left, right);
|
|
19
19
|
},
|
|
20
|
+
getGlyphLayoutVersion() {
|
|
21
|
+
// A pre-baked font never relocates a glyph — its pages are authored, not packed at runtime — so
|
|
22
|
+
// the placement revision is a constant and a consumer that bakes these rects never re-bakes.
|
|
23
|
+
// This is the whole reason the seam reports a number rather than the consumer polling rects.
|
|
24
|
+
return 0;
|
|
25
|
+
},
|
|
20
26
|
getGlyphMetrics() {
|
|
21
27
|
return getBitmapFontMetrics(font);
|
|
22
28
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitmapFontGlyphSource.js","sourceRoot":"","sources":["../src/bitmapFontGlyphSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE9F,sGAAsG;AACtG,mGAAmG;AACnG,0FAA0F;AAC1F,yGAAyG;AACzG,MAAM,UAAU,+BAA+B,CAAC,IAA0B;IACxE,OAAO;QACL,kBAAkB,CAAC,IAAI,GAAG,CAAC;YACzB,gGAAgG;YAChG,wFAAwF;YACxF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;YAC1C,OAAO,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7D,CAAC;QACD,aAAa,CAAC,SAAS;YACrB,OAAO,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,eAAe,CAAC,IAAI,EAAE,KAAK;YACzB,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;QACD,eAAe;YACb,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"bitmapFontGlyphSource.js","sourceRoot":"","sources":["../src/bitmapFontGlyphSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE9F,sGAAsG;AACtG,mGAAmG;AACnG,0FAA0F;AAC1F,yGAAyG;AACzG,MAAM,UAAU,+BAA+B,CAAC,IAA0B;IACxE,OAAO;QACL,kBAAkB,CAAC,IAAI,GAAG,CAAC;YACzB,gGAAgG;YAChG,wFAAwF;YACxF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;YAC1C,OAAO,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7D,CAAC;QACD,aAAa,CAAC,SAAS;YACrB,OAAO,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,eAAe,CAAC,IAAI,EAAE,KAAK;YACzB,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;QACD,qBAAqB;YACnB,gGAAgG;YAChG,6FAA6F;YAC7F,6FAA6F;YAC7F,OAAO,CAAC,CAAC;QACX,CAAC;QACD,eAAe;YACb,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/bitmapfont",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.638.d4dbd4e",
|
|
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/log": "0.5.1-next.
|
|
42
|
-
"@flighthq/texture": "0.5.1-next.
|
|
43
|
-
"@flighthq/textureatlas": "0.5.1-next.
|
|
44
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/log": "0.5.1-next.638.d4dbd4e",
|
|
42
|
+
"@flighthq/texture": "0.5.1-next.638.d4dbd4e",
|
|
43
|
+
"@flighthq/textureatlas": "0.5.1-next.638.d4dbd4e",
|
|
44
|
+
"@flighthq/types": "0.5.1-next.638.d4dbd4e"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@flighthq/glyphatlas": "*",
|
|
@@ -18,6 +18,19 @@ describe('createGlyphSourceFromBitmapFont', () => {
|
|
|
18
18
|
expect(source.getGlyphMetrics()).toEqual({ ascent: 8, descent: 2, lineGap: 1 });
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
// The static half of the seam: a pre-baked font's pages are authored, so no lookup can relocate a
|
|
22
|
+
// glyph and a consumer that bakes these rects never has to re-bake. Holding the version constant
|
|
23
|
+
// across lookups is what lets `refreshBitmapTextGlyphLayout` cost a static font nothing.
|
|
24
|
+
it('holds the layout version constant, because a pre-baked font never relocates a glyph', () => {
|
|
25
|
+
const font = createBitmapFont(sampleFontData());
|
|
26
|
+
const source = createGlyphSourceFromBitmapFont(font);
|
|
27
|
+
|
|
28
|
+
const before = source.getGlyphLayoutVersion();
|
|
29
|
+
source.getGlyphEntry(65);
|
|
30
|
+
source.getGlyphEntry(0x1f600);
|
|
31
|
+
expect(source.getGlyphLayoutVersion()).toBe(before);
|
|
32
|
+
});
|
|
33
|
+
|
|
21
34
|
it('pairs page 0 with the font atlas image and has no other page', () => {
|
|
22
35
|
const image = {} as Image;
|
|
23
36
|
const font = createBitmapFont({ ...sampleFontData(), pages: [createTextureAtlasFromImageResource(image)] });
|