@openmaic/renderer 0.2.1 → 0.2.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/FONTS.md CHANGED
@@ -24,6 +24,22 @@ the fonts.
24
24
  | `ZcoolHappy` | 站酷快乐体 | 站酷 (ZCOOL) free-use license (永久免费授权所有人使用,可免费商用) | ✅ (conditions) | © ZCOOL (站酷), designers retain attribution — [license](./font-licenses/ZcoolHappy-LICENSE.txt) |
25
25
  | `WenDingPLKaiTi` | 文鼎PL简中楷 (AR PL KaitiM GB) | Arphic Public License (1999) | ✅ | © 1994–1999 Arphic Technology Co., Ltd. — [license](./font-licenses/ARPHIC-PL.txt) |
26
26
 
27
+ ### Aliases (`picker-fonts.css`)
28
+
29
+ The opt-in `picker-fonts.css` declares four other names for faces above, from
30
+ `FONT_ALIASES` in `fonts.config.mjs`. They are the Google Fonts names of the
31
+ same typefaces, which the `@openmaic/editor` default font picker writes into
32
+ slides. An alias is only another CSS `font-family` name: its rule points at the
33
+ same woff2 as its target, so no extra font is served and the font files are
34
+ unchanged.
35
+
36
+ | Alias (`font-family`) | Renders with |
37
+ | --------------------- | ----------------- |
38
+ | `Noto Sans SC` | `SourceHanSans` |
39
+ | `Noto Serif SC` | `SourceHanSerif` |
40
+ | `LXGW WenKai` | `LXGWWenKai` |
41
+ | `ZCOOL KuaiLe` | `ZcoolHappy` |
42
+
27
43
  ✅ = free to redistribute (bundle/embed/serve) as long as its conditions are met
28
44
  (notice/license travels with it; not sold on its own). The four OFL faces are
29
45
  OFL 1.1; `ZcoolHappy` is permanently free for everyone to use with the
package/README.md CHANGED
@@ -224,6 +224,20 @@ once at your app shell to make those faces available:
224
224
  import '@openmaic/renderer/fonts.css';
225
225
  ```
226
226
 
227
+ Slides whose fonts were picked in `@openmaic/editor`'s default picker name the
228
+ Google Fonts versions of those typefaces (`Noto Sans SC`, `Noto Serif SC`,
229
+ `LXGW WenKai`, `ZCOOL KuaiLe`). To render them, also import the opt-in alias
230
+ sheet, which maps those names onto the same files:
231
+
232
+ ```ts
233
+ import '@openmaic/renderer/picker-fonts.css';
234
+ ```
235
+
236
+ It claims the four names for the whole page with no `unicode-range`: any text
237
+ set in one of them renders with, and downloads, the whole self-hosted file
238
+ (SourceHanSans is about 7.5 MB, SourceHanSerif about 10 MB). Leave it out if
239
+ your page loads its own faces under these names.
240
+
227
241
  > **Runtime dependency — read this.** The `@font-face` `src` URLs point at an
228
242
  > external font host (`https://file.maic.chat/fonts/<name>.woff2`); the woff2
229
243
  > files are **not** bundled in the package. So this is a hard runtime dependency:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmaic/renderer",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "React component for rendering PPTist-style Slide JSON, extracted from OpenMAIC.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,6 +24,7 @@
24
24
  "import": "./dist/snapshot/index.js"
25
25
  },
26
26
  "./fonts.css": "./fonts.css",
27
+ "./picker-fonts.css": "./picker-fonts.css",
27
28
  "./geometry": {
28
29
  "types": "./dist/utils/element.d.ts",
29
30
  "import": "./dist/utils/element.js"
@@ -32,6 +33,7 @@
32
33
  "files": [
33
34
  "dist",
34
35
  "fonts.css",
36
+ "picker-fonts.css",
35
37
  "README.md",
36
38
  "DESIGN.md",
37
39
  "LICENSE",
@@ -0,0 +1,36 @@
1
+ /**
2
+ * GENERATED FILE — do not edit by hand.
3
+ * Source of truth: FONT_ALIASES in fonts.config.mjs (run `pnpm run genfonts`).
4
+ *
5
+ * Opt-in. Declares the Google Fonts names that the @openmaic/editor default
6
+ * font picker writes for its Chinese fonts, over the self-hosted faces in
7
+ * fonts.css, so a slide set in one of them renders in it wherever it is shown:
8
+ * import '@openmaic/renderer/picker-fonts.css';
9
+ *
10
+ * Importing it claims these family names for the whole page, and each covers
11
+ * every character with no unicode-range: any text on the page set in one of
12
+ * them, slide or not, renders with (and downloads) the whole self-hosted file.
13
+ * Do not import it if the page loads its own faces under these names.
14
+ */
15
+ @font-face {
16
+ font-display: swap;
17
+ font-family: 'Noto Sans SC';
18
+ font-weight: 250 900;
19
+ src: url('https://file.maic.chat/fonts/SourceHanSans.woff2') format('woff2');
20
+ }
21
+ @font-face {
22
+ font-display: swap;
23
+ font-family: 'Noto Serif SC';
24
+ font-weight: 250 900;
25
+ src: url('https://file.maic.chat/fonts/SourceHanSerif.woff2') format('woff2');
26
+ }
27
+ @font-face {
28
+ font-display: swap;
29
+ font-family: 'LXGW WenKai';
30
+ src: url('https://file.maic.chat/fonts/LXGWWenKai.woff2') format('woff2');
31
+ }
32
+ @font-face {
33
+ font-display: swap;
34
+ font-family: 'ZCOOL KuaiLe';
35
+ src: url('https://file.maic.chat/fonts/ZcoolHappy.woff2') format('woff2');
36
+ }