Major update for v1 and tests
This commit is contained in:
0
fonts/.gitkeep
Normal file
0
fonts/.gitkeep
Normal file
44
fonts/README.md
Normal file
44
fonts/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Server-side font files
|
||||
|
||||
This directory is scanned by `server.js` at startup. Each `.ttf` or `.otf` file
|
||||
is registered with node-canvas via `registerFont()` so that exports render
|
||||
text in the same fonts the editor previews.
|
||||
|
||||
## Filename convention
|
||||
|
||||
```
|
||||
<Family_Name>-<Variant>.ttf
|
||||
```
|
||||
|
||||
- Spaces in family names become underscores in the filename so the file is
|
||||
portable across operating systems. The server replaces them back to spaces
|
||||
at registration time.
|
||||
- The variant is parsed for the substrings `Bold` and `Italic` to set the
|
||||
`weight` and `style` registration options. `Regular` (or anything else) is
|
||||
treated as the default weight.
|
||||
|
||||
Examples:
|
||||
| File | Family | Weight | Style |
|
||||
|---|---|---|---|
|
||||
| `Roboto-Regular.ttf` | Roboto | normal | normal |
|
||||
| `Roboto-Bold.ttf` | Roboto | bold | normal |
|
||||
| `DM_Sans-Regular.ttf` | DM Sans | normal | normal |
|
||||
| `Open_Sans-BoldItalic.ttf` | Open Sans | bold | italic |
|
||||
|
||||
## Populating this directory
|
||||
|
||||
```
|
||||
npm run fetch-fonts
|
||||
```
|
||||
|
||||
This downloads TTFs for the editor's font list from the Fontsource jsDelivr
|
||||
CDN. Re-running is a no-op for already-present files; pass `--force` to
|
||||
re-download.
|
||||
|
||||
## What if I leave it empty?
|
||||
|
||||
The server still starts and exports still work, but every text element will
|
||||
render in whatever fallback font the host system happens to have for the
|
||||
requested family. On a stock Alpine container that's a generic sans-serif. On
|
||||
macOS dev machines, system-installed fonts usually fill in for the common
|
||||
names but not the more specialized ones.
|
||||
Reference in New Issue
Block a user