@typstream/google-fonts 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ikram Hasan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # @typstream/google-fonts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Any family of the [Google Fonts](https://fonts.google.com) library in typstream documents, by name:
4
+
5
+ ```typst
6
+ #set text(font: "Lora")
7
+ #show heading: set text(font: "Playfair Display")
8
+ #text(font: "Caveat")[Show your working.]
9
+ ```
10
+
11
+ ```tsx
12
+ import { googleFonts } from "@typstream/google-fonts";
13
+
14
+ <Typstream source={text} plugins={[googleFonts]} />;
15
+ // The model learns it may use them:
16
+ buildSystemPrompt([edu, googleFonts]);
17
+ ```
18
+
19
+ - **A font catalogue.** `catalogue.json` lists every family of github.com/google/fonts at one commit, with its TTF files (style, weight or a variable font's weight range, size), served by jsDelivr from that commit. When a document names a family the engine doesn't have, the engine fetches the index (once), downloads the family and compiles the document again. Files over 20 MB, which jsDelivr won't serve, are left out; families over 5 MB (`createGoogleFonts({ maxBytes })`) aren't loaded.
20
+ - **HTML target.** Typst's HTML export drops fonts, so the preamble (`googleFontsPreamble`) marks text in another font than the document's own with its family (`<span data-typstream-font="lora">`), outside equations and frames. `mountTypstream` shows the families the engine loaded as web fonts made from the same files.
21
+ - **Prompt rules.** Exact names, one or two families, and the families that stand in for Arial, Times New Roman, Calibri and others, which aren't in the library.
22
+ - **Network.** Readers' browsers download from `cdn.jsdelivr.net` (allow it in `connect-src`). To avoid that, mirror the files and pass a copy of the index whose `base` points at the mirror: `createGoogleFonts({ index })`.
23
+
24
+ `node scripts/catalogue.mjs [<commit>]` writes `catalogue.json` again: one GitHub API call for the repository's tree, then each family's `METADATA.pb`.
25
+
26
+ Docs: [Fonts and languages](https://typstream.vercel.app/docs/guides/fonts-and-languages#any-google-fonts-family), [reference](https://typstream.vercel.app/docs/reference/google-fonts).
27
+
28
+ ## License
29
+
30
+ MIT. The fonts are downloaded from the Google Fonts library when a document uses them, each under its own license
31
+ (most under the SIL Open Font License); none ship in this package.