Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Fonts: pin craft-fonts bfcbf71; CRAFT_FONTS_REQUIRED fails without CRAFT_FONTS_DIR (#2646)

aionggfbeccbe9bc54
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml
index 0139df440..0ad9259d9 100644
--- a/.github/workflows/freebsd.yml
+++ b/.github/workflows/freebsd.yml
@@ -30,6 +30,6 @@ jobs:
# Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
uses: storytold/craft-common-actions/.github/workflows/freebsd.yml@main
with:
- craft-fonts-ref: abb83316d96aa59c1cf64784289e378fe9fa5695
+ craft-fonts-ref: bfcbf714e45a3ea8e98f88ab2b7971372a576414
skip-tests: true
run-package-check: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index bdd7ab2d4..546475f32 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -64,7 +64,7 @@ jobs:
with:
app-name: filmcraft
app-title: FilmCraft
- craft-fonts-ref: abb83316d96aa59c1cf64784289e378fe9fa5695
+ craft-fonts-ref: bfcbf714e45a3ea8e98f88ab2b7971372a576414
version: ${{ inputs.version }}
secrets:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md
index 48f5be394..e8a3a0aa2 100644
--- a/ATTRIBUTION.md
+++ b/ATTRIBUTION.md
@@ -130,6 +130,10 @@ carry each font's licence as `OFL-<family>.txt`.
| BIZ UDPGothic Regular, Bold (Morisawa) | Japanese UI text; Japanese fallback for sans titles (the web build embeds only Regular) | OFL-1.1 |
| Shippori Mincho Regular (FONTDASU) | Japanese fallback for serif titles (native builds) | OFL-1.1 |
| BIZ UDMincho Regular (Morisawa) | Japanese fallback for serif titles (native builds) | OFL-1.1 |
+| Noto Sans CJK SC Regular (Google, Adobe) | Chinese UI text and media names; Chinese fallback for titles (native builds) | OFL-1.1 |
+| Noto Sans Arabic Regular (Google) | Arabic UI text; Arabic fallback for titles (native builds) | OFL-1.1 |
+| Noto Sans Thai Regular (Google) | Thai fallback for titles (native builds) | OFL-1.1 |
+| Noto Sans Georgian Regular (Google) | Georgian fallback for titles (native builds) | OFL-1.1 |
## First-party brand marks
diff --git a/NOTICE b/NOTICE
index 221a0acc6..d0d113091 100644
--- a/NOTICE
+++ b/NOTICE
@@ -17,5 +17,5 @@ Noto Serif font (assets/fonts/NotoSerif-Regular.ttf) — OFL-1.1. See assets/fon
JetBrains Mono font (assets/fonts/JetBrainsMono-Regular.ttf) — OFL-1.1. See assets/fonts/OFL-JetBrainsMono.txt.
Builds made with craft-fonts (CRAFT_FONTS_DIR; all official releases) also embed the fonts listed in
https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md (BIZ UDPGothic, Shippori Mincho,
-BIZ UDMincho) — OFL-1.1. Their licence texts ship with the packages as OFL-<family>.txt.
+BIZ UDMincho, Noto Sans CJK SC, Noto Sans Arabic, Noto Sans Thai, Noto Sans Georgian) — OFL-1.1. Their licence texts ship with the packages as OFL-<family>.txt.
Public-domain film and NASA frames and CC0 music shown in README screenshots (docs/images/) — public domain / CC0-1.0. See ATTRIBUTION.md.
diff --git a/crates/text/build.rs b/crates/text/build.rs
index 715a8b7df..17a5bf843 100644
--- a/crates/text/build.rs
+++ b/crates/text/build.rs
@@ -5,7 +5,8 @@
//! `crates/text`) this embeds every font listed in its
//! `fonts/manifest.txt` as [`CRAFT_FONTS`](crate::fonts::CRAFT_FONTS); unset, `CRAFT_FONTS` is
//! empty and nothing else changes. A `CRAFT_FONTS_DIR` that is not a checkout is a warning, or an
-//! error with `CRAFT_FONTS_REQUIRED=1` (release builds).
+//! error with `CRAFT_FONTS_REQUIRED=1` (release builds), which also makes an unset or empty
+//! `CRAFT_FONTS_DIR` an error.
//!
//! Native builds embed every font. The web (wasm32) build embeds only the UI font (BIZ UDPGothic
//! Regular, ~4.5 MB) to stay under the web size budget (Cloudflare serves files up to 25 MiB).
@@ -18,15 +19,18 @@ fn main() {
println!("cargo::rerun-if-changed=build.rs");
println!("cargo::rerun-if-env-changed=CRAFT_FONTS_DIR");
println!("cargo::rerun-if-env-changed=CRAFT_FONTS_REQUIRED");
+ let required = std::env::var_os("CRAFT_FONTS_REQUIRED").is_some_and(|v| v == "1");
let mut src = String::from("pub static CRAFT_FONTS: &[CraftFont] = &[\n");
- if let Some(dir) = std::env::var_os("CRAFT_FONTS_DIR").map(PathBuf::from) {
- match craft_fonts(&dir) {
+ match std::env::var_os("CRAFT_FONTS_DIR").filter(|d| !d.is_empty()).map(PathBuf::from) {
+ Some(dir) => match craft_fonts(&dir) {
Ok(entries) => src.push_str(&entries),
- Err(e) if std::env::var_os("CRAFT_FONTS_REQUIRED").is_some() => {
- println!("cargo::error=CRAFT_FONTS_DIR={}: {e}", dir.display());
- }
+ Err(e) if required => println!("cargo::error=CRAFT_FONTS_DIR={}: {e}", dir.display()),
Err(e) => println!("cargo::warning=building without craft-fonts: CRAFT_FONTS_DIR={}: {e}", dir.display()),
+ },
+ None if required => {
+ println!("cargo::error=CRAFT_FONTS_REQUIRED=1 but CRAFT_FONTS_DIR is unset or empty: point it at a craft-fonts checkout (absolute path)");
}
+ None => {}
}
src.push_str("];\n");
let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap_or_default()).join("craft_fonts.rs");
diff --git a/docs/contributing.md b/docs/contributing.md
index 84e99750d..b1e1222c7 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -89,7 +89,8 @@ Regular, to keep the wasm small). The Japanese ones become the last fallback of
(`crates/ui-egui/src/theme.rs`, BIZ UDPGothic first) and fallback faces in the text engine (Gothic
for sans text, Mincho for serif text). Without `CRAFT_FONTS_DIR`, `CRAFT_FONTS` is empty and
FilmCraft uses its bundled and system fonts. A `CRAFT_FONTS_DIR` that is not a checkout is a build
-warning, or an error with `CRAFT_FONTS_REQUIRED=1` (release builds set both). Tests on these fonts'
+warning, or an error with `CRAFT_FONTS_REQUIRED=1` (release builds set both). With
+`CRAFT_FONTS_REQUIRED=1`, a build without `CRAFT_FONTS_DIR` is an error too. Tests on these fonts'
glyphs skip when it is empty; when you touch fonts, run the gates both with and without it.
Chinese media names and track labels use the `Hans` / `Hant` craft-fonts faces after the Japanese
diff --git a/docs/releasing.md b/docs/releasing.md
index 58c283743..d3f482b41 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -59,8 +59,8 @@ signing jobs are refused, and the draft-release job, which needs them, is skippe
`filmcraft --version` and `filmcraft-cli --version` print the version from `Cargo.toml`.
**Fonts.** Every build job checks out [craft-fonts](https://github.com/storytold/craft-fonts) at a
-pinned commit (the `ref:` of its craft-fonts checkout step, marked `# bump deliberately`) and builds
-with `CRAFT_FONTS_DIR` and `CRAFT_FONTS_REQUIRED=1`, so releases embed its Japanese fonts and fail
+pinned commit (`craft-fonts-ref` in `.github/workflows/release.yml` and `freebsd.yml`) and builds
+with `CRAFT_FONTS_DIR` and `CRAFT_FONTS_REQUIRED=1`, so releases embed its fonts and fail
rather than ship without them (the web build embeds only the UI font, to stay small). The packages
carry each embedded font's licence (`copy_font_licences` in `packaging/env.sh`). Bump the pins
deliberately, in every job at once.