@flighthq/bitmapfont 0.2.1-next.841.373388f → 0.3.0-next.1032.e2b99fc
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/bitmapFont.d.ts +1 -1
- package/dist/bitmapFont.d.ts.map +1 -1
- package/dist/bitmapFontGlyphSource.d.ts +1 -1
- package/dist/bitmapFontGlyphSource.d.ts.map +1 -1
- package/dist/bitmapFontGlyphSource.js +2 -1
- package/dist/bitmapFontGlyphSource.js.map +1 -1
- package/dist/contract.d.ts +3 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +3 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
- package/src/bitmapFont.test.ts +2 -2
- package/src/bitmapFontGlyphSource.test.ts +4 -4
package/dist/bitmapFont.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BitmapFont, BitmapFontData, GlyphEntry, GlyphMetrics, TextureAtlas } from '@flighthq/types';
|
|
1
|
+
import type { BitmapFont, BitmapFontData, GlyphEntry, GlyphMetrics, TextureAtlas } from '@flighthq/types/contract';
|
|
2
2
|
export declare function createBitmapFont(data: Readonly<BitmapFontData>): BitmapFont;
|
|
3
3
|
export declare function getBitmapFontGlyph(font: Readonly<BitmapFont>, codepoint: number): GlyphEntry | null;
|
|
4
4
|
export declare function getBitmapFontKerning(font: Readonly<BitmapFont>, left: number, right: number): number;
|
package/dist/bitmapFont.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitmapFont.d.ts","sourceRoot":"","sources":["../src/bitmapFont.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bitmapFont.d.ts","sourceRoot":"","sources":["../src/bitmapFont.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AASnH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,UAAU,CAiC3E;AAID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAEnG;AAID,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpG;AAGD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAEvF;AAKD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,SAAI,GAAG,YAAY,GAAG,IAAI,CAE3F;AAID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,YAAY,EAAE,CAEtF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { BitmapFont, GlyphSource } from '@flighthq/types';
|
|
1
|
+
import type { BitmapFont, GlyphSource } from '@flighthq/types/contract';
|
|
2
2
|
export declare function createGlyphSourceFromBitmapFont(font: Readonly<BitmapFont>): GlyphSource;
|
|
3
3
|
//# sourceMappingURL=bitmapFontGlyphSource.d.ts.map
|
|
@@ -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,
|
|
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,CAkBvF"}
|
|
@@ -8,7 +8,8 @@ export function createGlyphSourceFromBitmapFont(font) {
|
|
|
8
8
|
getGlyphAtlasImage(page = 0) {
|
|
9
9
|
// Each page's atlas image, indexed by the glyph's `page`. An out-of-range page (or a page whose
|
|
10
10
|
// atlas carries no image yet) yields null — the renderer skips glyphs it cannot sample.
|
|
11
|
-
|
|
11
|
+
const texture = font.pages[page]?.texture;
|
|
12
|
+
return texture?.storage.dimension === '2d' ? texture.storage.image : null;
|
|
12
13
|
},
|
|
13
14
|
getGlyphEntry(codepoint) {
|
|
14
15
|
return getBitmapFontGlyph(font, codepoint);
|
|
@@ -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,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,IAAI,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,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAC5E,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC"}
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './bitmapFontGlyphSource';
|
|
1
|
+
export { createBitmapFont, createGlyphSourceFromBitmapFont, getBitmapFontGlyph, getBitmapFontKerning, getBitmapFontMetrics, getBitmapFontPage, getBitmapFontPages, } from './contract';
|
|
3
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './bitmapFontGlyphSource';
|
|
1
|
+
export { createBitmapFont, createGlyphSourceFromBitmapFont, getBitmapFontGlyph, getBitmapFontKerning, getBitmapFontMetrics, getBitmapFontPage, getBitmapFontPages, } from './contract';
|
|
3
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/bitmapfont",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.1032.e2b99fc",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/flighthq/flight.git",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./contract": {
|
|
18
|
+
"types": "./dist/contract.d.ts",
|
|
19
|
+
"default": "./dist/contract.js"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"files": [
|
|
@@ -32,8 +36,8 @@
|
|
|
32
36
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
33
37
|
},
|
|
34
38
|
"dependencies": {
|
|
35
|
-
"@flighthq/textureatlas": "0.
|
|
36
|
-
"@flighthq/types": "0.
|
|
39
|
+
"@flighthq/textureatlas": "0.3.0-next.1032.e2b99fc",
|
|
40
|
+
"@flighthq/types": "0.3.0-next.1032.e2b99fc"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
43
|
"typescript": "^5.3.0"
|
package/src/bitmapFont.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createTextureAtlas } from '@flighthq/textureatlas';
|
|
2
|
-
import type { BitmapFontData } from '@flighthq/types';
|
|
1
|
+
import { createTextureAtlas } from '@flighthq/textureatlas/contract';
|
|
2
|
+
import type { BitmapFontData } from '@flighthq/types/contract';
|
|
3
3
|
import { describe, expect, it } from 'vitest';
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createTextureAtlas } from '@flighthq/textureatlas';
|
|
2
|
-
import type { BitmapFontData, ImageResource } from '@flighthq/types';
|
|
1
|
+
import { createTextureAtlas, createTextureAtlasFromImageResource } from '@flighthq/textureatlas/contract';
|
|
2
|
+
import type { BitmapFontData, ImageResource } from '@flighthq/types/contract';
|
|
3
3
|
import { describe, expect, it } from 'vitest';
|
|
4
4
|
|
|
5
5
|
import { createBitmapFont, getBitmapFontGlyph } from './bitmapFont';
|
|
@@ -20,7 +20,7 @@ describe('createGlyphSourceFromBitmapFont', () => {
|
|
|
20
20
|
|
|
21
21
|
it('pairs page 0 with the font atlas image and has no other page', () => {
|
|
22
22
|
const image = {} as ImageResource;
|
|
23
|
-
const font = createBitmapFont({ ...sampleFontData(), pages: [
|
|
23
|
+
const font = createBitmapFont({ ...sampleFontData(), pages: [createTextureAtlasFromImageResource(image)] });
|
|
24
24
|
const source = createGlyphSourceFromBitmapFont(font);
|
|
25
25
|
|
|
26
26
|
expect(source.getGlyphAtlasImage(0)).toBe(image);
|
|
@@ -33,7 +33,7 @@ describe('createGlyphSourceFromBitmapFont', () => {
|
|
|
33
33
|
const image1 = {} as ImageResource;
|
|
34
34
|
const font = createBitmapFont({
|
|
35
35
|
...sampleFontData(),
|
|
36
|
-
pages: [
|
|
36
|
+
pages: [createTextureAtlasFromImageResource(image0), createTextureAtlasFromImageResource(image1)],
|
|
37
37
|
});
|
|
38
38
|
const source = createGlyphSourceFromBitmapFont(font);
|
|
39
39
|
|