@bloxwap/font 0.1.1 → 0.1.2
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 +4 -1
- package/package.json +2 -2
- package/src/mono-italic.js +19 -0
- package/src/mono.d.ts +4 -0
- package/src/mono.js +9 -5
- package/src/pixel-italic.js +19 -0
- package/src/pixel.d.ts +4 -0
- package/src/pixel.js +7 -5
- package/src/sans-italic.js +19 -0
- package/src/sans.d.ts +4 -0
- package/src/sans.js +9 -5
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ npm install @bloxwap/font
|
|
|
9
9
|
|
|
10
10
|
## Next.js
|
|
11
11
|
|
|
12
|
+
The `next/font` exports need Next.js 15 or later.
|
|
13
|
+
|
|
12
14
|
```tsx title="app/layout.tsx"
|
|
13
15
|
import { BloxwapSans } from '@bloxwap/font/sans';
|
|
14
16
|
import { BloxwapMono } from '@bloxwap/font/mono';
|
|
@@ -22,7 +24,8 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
22
24
|
}
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
`BloxwapSans`, `BloxwapMono` and `BloxwapPixel` come from `next/font/local`, so Next.js self-hosts and preloads
|
|
27
|
+
`BloxwapSans`, `BloxwapMono` and `BloxwapPixel` come from `next/font/local`, so Next.js self-hosts them and preloads
|
|
28
|
+
the normal face. The italic is in the same family but isn't preloaded: a page downloads it only when it renders italic text.
|
|
26
29
|
`.variable` defines `--font-bloxwap-sans`, `--font-bloxwap-mono` and `--font-bloxwap-pixel`:
|
|
27
30
|
|
|
28
31
|
```css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloxwap/font",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Bloxwap Sans, Mono and Pixel: rounded variable web fonts with Arabic, Hebrew, Armenian, Georgian, Japanese, Korean and Chinese companions. next/font exports and a plain CSS stylesheet.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "OFL-1.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"prepack": "node scripts/build.mjs"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"next": ">=
|
|
78
|
+
"next": ">=15.0.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"next": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import localFont from 'next/font/local';
|
|
2
|
+
|
|
3
|
+
// The italic face of Bloxwap Mono, imported for its side effect by ./mono.js. It is a separate next/font call so that it
|
|
4
|
+
// can opt out of preloading: `preload` applies to every file in a call, and a page that never renders italic text
|
|
5
|
+
// would otherwise download the italic as well. Without a preload, the browser fetches this face only when text uses it.
|
|
6
|
+
//
|
|
7
|
+
// From Next.js 15, next/font/local names the family after the const the call is assigned to (Next 13.2-14 hashed it
|
|
8
|
+
// per call, hence the `next >=15` peer range), so this const must stay `BloxwapMono`:
|
|
9
|
+
// that adds the italic to the same family as the normal face in ./mono.js, and <em> gets the real italic, not a
|
|
10
|
+
// synthesized slant.
|
|
11
|
+
const BloxwapMono = localFont({
|
|
12
|
+
src: [{ path: '../fonts/BloxwapMono/BloxwapMono-Italic-Variable.woff2', weight: '100 900', style: 'italic' }],
|
|
13
|
+
display: 'swap',
|
|
14
|
+
preload: false,
|
|
15
|
+
// Like ./mono.js, no metric-adjusted fallback face.
|
|
16
|
+
adjustFontFallback: false,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default BloxwapMono;
|
package/src/mono.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { BloxwapFont } from './font';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Bloxwap Mono (`next/font/local`): `variable` sets --font-bloxwap-mono. Only the normal face is preloaded; the real
|
|
5
|
+
* italic is in the same family and downloads only when a page renders italic text.
|
|
6
|
+
*/
|
|
3
7
|
export declare const BloxwapMono: BloxwapFont;
|
package/src/mono.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import localFont from 'next/font/local';
|
|
2
2
|
// The companion scripts (Arabic, Hebrew, Armenian, Georgian, CJK) as one fallback family with unicode-range.
|
|
3
3
|
import '../mono-scripts.css';
|
|
4
|
+
// The italic face: the same family, not preloaded, so it downloads only when a page renders italic text.
|
|
5
|
+
import './mono-italic.js';
|
|
4
6
|
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Bloxwap Mono for Next.js: variable weight 100–900 with italics; `variable` sets --font-bloxwap-mono.
|
|
9
|
+
* Next.js preloads the normal face; the italic loads only when a page renders italic text.
|
|
10
|
+
*/
|
|
6
11
|
export const BloxwapMono = localFont({
|
|
7
|
-
src:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
],
|
|
12
|
+
// No `style` on this src: with a single file next/font copies its style onto className and .style, and a
|
|
13
|
+
// `font-style: normal` there would cancel inherited italics (<em><code className>) and fall back to the normal face.
|
|
14
|
+
src: [{ path: '../fonts/BloxwapMono/BloxwapMono-Variable.woff2', weight: '100 900' }],
|
|
11
15
|
variable: '--font-bloxwap-mono',
|
|
12
16
|
display: 'swap',
|
|
13
17
|
adjustFontFallback: false,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import localFont from 'next/font/local';
|
|
2
|
+
|
|
3
|
+
// The italic face of Bloxwap Pixel, imported for its side effect by ./pixel.js. It is a separate next/font call so that it
|
|
4
|
+
// can opt out of preloading: `preload` applies to every file in a call, and a page that never renders italic text
|
|
5
|
+
// would otherwise download the italic as well. Without a preload, the browser fetches this face only when text uses it.
|
|
6
|
+
//
|
|
7
|
+
// From Next.js 15, next/font/local names the family after the const the call is assigned to (Next 13.2-14 hashed it
|
|
8
|
+
// per call, hence the `next >=15` peer range), so this const must stay `BloxwapPixel`:
|
|
9
|
+
// that adds the italic to the same family as the normal face in ./pixel.js, and <em> gets the real italic, not a
|
|
10
|
+
// synthesized slant.
|
|
11
|
+
const BloxwapPixel = localFont({
|
|
12
|
+
src: [{ path: '../fonts/BloxwapPixel/BloxwapPixel-Italic-Variable.woff2', weight: '100 900', style: 'italic' }],
|
|
13
|
+
display: 'swap',
|
|
14
|
+
preload: false,
|
|
15
|
+
// Like ./pixel.js, no metric-adjusted fallback face.
|
|
16
|
+
adjustFontFallback: false,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default BloxwapPixel;
|
package/src/pixel.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { BloxwapFont } from './font';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Bloxwap Pixel (`next/font/local`): `variable` sets --font-bloxwap-pixel. Only the normal face is preloaded; the real
|
|
5
|
+
* italic is in the same family and downloads only when a page renders italic text.
|
|
6
|
+
*/
|
|
3
7
|
export declare const BloxwapPixel: BloxwapFont;
|
package/src/pixel.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import localFont from 'next/font/local';
|
|
2
|
+
// The italic face: the same family, not preloaded, so it downloads only when a page renders italic text.
|
|
3
|
+
import './pixel-italic.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Bloxwap Pixel for Next.js: variable weight 100–900 and roundness (set `font-variation-settings: "ROND" 0–100`),
|
|
5
|
-
* with italics; `variable` sets --font-bloxwap-pixel.
|
|
7
|
+
* with italics; `variable` sets --font-bloxwap-pixel. Next.js preloads the normal face; the italic loads only when a
|
|
8
|
+
* page renders italic text.
|
|
6
9
|
*/
|
|
7
10
|
export const BloxwapPixel = localFont({
|
|
8
|
-
src:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
],
|
|
11
|
+
// No `style` on this src: with a single file next/font copies its style onto className and .style, and a
|
|
12
|
+
// `font-style: normal` there would cancel inherited italics (<em><code className>) and fall back to the normal face.
|
|
13
|
+
src: [{ path: '../fonts/BloxwapPixel/BloxwapPixel-Variable.woff2', weight: '100 900' }],
|
|
12
14
|
variable: '--font-bloxwap-pixel',
|
|
13
15
|
display: 'swap',
|
|
14
16
|
adjustFontFallback: false,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import localFont from 'next/font/local';
|
|
2
|
+
|
|
3
|
+
// The italic face of Bloxwap Sans, imported for its side effect by ./sans.js. It is a separate next/font call so that it
|
|
4
|
+
// can opt out of preloading: `preload` applies to every file in a call, and a page that never renders italic text
|
|
5
|
+
// would otherwise download the italic as well. Without a preload, the browser fetches this face only when text uses it.
|
|
6
|
+
//
|
|
7
|
+
// From Next.js 15, next/font/local names the family after the const the call is assigned to (Next 13.2-14 hashed it
|
|
8
|
+
// per call, hence the `next >=15` peer range), so this const must stay `BloxwapSans`:
|
|
9
|
+
// that adds the italic to the same family as the normal face in ./sans.js, and <em> gets the real italic, not a
|
|
10
|
+
// synthesized slant.
|
|
11
|
+
const BloxwapSans = localFont({
|
|
12
|
+
src: [{ path: '../fonts/BloxwapSans/BloxwapSans-Italic-Variable.woff2', weight: '100 900', style: 'italic' }],
|
|
13
|
+
display: 'swap',
|
|
14
|
+
preload: false,
|
|
15
|
+
// Like ./sans.js, no metric-adjusted fallback face.
|
|
16
|
+
adjustFontFallback: false,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default BloxwapSans;
|
package/src/sans.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { BloxwapFont } from './font';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Bloxwap Sans (`next/font/local`): `variable` sets --font-bloxwap-sans. Only the normal face is preloaded; the real
|
|
5
|
+
* italic is in the same family and downloads only when a page renders italic text.
|
|
6
|
+
*/
|
|
3
7
|
export declare const BloxwapSans: BloxwapFont;
|
package/src/sans.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import localFont from 'next/font/local';
|
|
2
2
|
// The companion scripts (Arabic, Hebrew, Armenian, Georgian, CJK) as one fallback family with unicode-range.
|
|
3
3
|
import '../sans-scripts.css';
|
|
4
|
+
// The italic face: the same family, not preloaded, so it downloads only when a page renders italic text.
|
|
5
|
+
import './sans-italic.js';
|
|
4
6
|
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Bloxwap Sans for Next.js: variable weight 100–900 with italics; `variable` sets --font-bloxwap-sans.
|
|
9
|
+
* Next.js preloads the normal face; the italic loads only when a page renders italic text.
|
|
10
|
+
*/
|
|
6
11
|
export const BloxwapSans = localFont({
|
|
7
|
-
src:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
],
|
|
12
|
+
// No `style` on this src: with a single file next/font copies its style onto className and .style, and a
|
|
13
|
+
// `font-style: normal` there would cancel inherited italics (<em><code className>) and fall back to the normal face.
|
|
14
|
+
src: [{ path: '../fonts/BloxwapSans/BloxwapSans-Variable.woff2', weight: '100 900' }],
|
|
11
15
|
variable: '--font-bloxwap-sans',
|
|
12
16
|
display: 'swap',
|
|
13
17
|
// A metric-adjusted Arial fallback would sit before the companions and draw Arabic and Hebrew in Arial.
|