Craft Anything: understand how any software works, and craft your own.
Rust
Korean, Chinese, Japanese and other scripts are tested to show in release builds, which ship their font licences (#29)
BFlat81c17813c906
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.mdindex c62aa929..3a5f2037 100644--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@ -46,5 +46,6 @@ the open-source licence; see `docs/brand/LICENSE-brand.txt`.## Optional build-time fonts-Builds made with `CRAFT_FONTS_DIR` (craft-fonts) also embed the fonts in that folder; their-licences ship with that folder and must be added to this list for such builds.+Builds made with `CRAFT_FONTS_DIR` (craft-fonts), releases among them, also embed the fonts in+that folder (all OFL-1.1). Their packages ship each one's licence as `OFL-<font>.txt`; craft-fonts'+own `ATTRIBUTION.md` names their authors and pinned sources.diff --git a/crates/ui-egui/build.rs b/crates/ui-egui/build.rsindex cd92ca0a..8d406407 100644--- a/crates/ui-egui/build.rs+++ b/crates/ui-egui/build.rs@@ -1,6 +1,7 @@-//! Optional craft-fonts (CJK/Arabic UI fallback fonts), following craft-fonts' `docs/integration.md`.+//! Optional craft-fonts (fallbacks for CJK, Arabic, Thai, Hebrew, Devanagari…), following+//! craft-fonts' `docs/integration.md`. Releases and CI set it.//!-//! Unset `CRAFT_FONTS_DIR` (the default) embeds nothing and the app uses its own Inter/JetBrains+//! Unset `CRAFT_FONTS_DIR` (the default) embeds nothing and the app uses its own DM Sans/JetBrains//! Mono. Set it to an absolute path of a craft-fonts checkout to embed every font its manifest//! lists. A bad path is a warning unless `CRAFT_FONTS_REQUIRED=1`.diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rsindex 2225c3f5..7fc06117 100644--- a/crates/ui-egui/src/theme.rs+++ b/crates/ui-egui/src/theme.rs@@ -405,6 +405,36 @@ mod tests {0.2126 * ch(c.r()) + 0.7152 * ch(c.g()) + 0.0722 * ch(c.b())}+ /// Releases are built with craft-fonts (#19), and so is CI; a build without them has only+ /// DM Sans, and shows other scripts as boxes.+ #[test]+ fn with_craft_fonts_every_script_people_type_shows() {+ if CRAFT_FONTS.is_empty() {+ return;+ }+ let ctx = egui::Context::default();+ install_fonts(&ctx);+ ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear();+ let texts = [+ ("Korean", "한국어 사용자"),+ ("Chinese", "你好,世界"),+ ("Japanese", "こんにちは、カタカナ"),+ ("Thai", "ภาษาไทย"),+ ("Arabic", "مرحبا بالعالم"),+ ("Hebrew", "שלום עולם"),+ ("Hindi", "नमस्ते दुनिया"),+ ("Vietnamese", "Tiếng Việt"),+ ("Russian", "Привет"),+ ("Greek", "Γειά σου"),+ ("arrows", "Settings → AI ← ↑ ↓"),+ ];+ for (script, text) in texts {+ for font in [FontId::proportional(14.0), FontId::monospace(14.0), medium(14.0), semibold(14.0)] {+ assert!(ctx.fonts_mut(|f| f.has_glyphs(&font, text)), "{script} ({text}) shows as boxes in {font:?}");+ }+ }+ }+#[test]fn a_scroll_thumb_at_rest_stands_out_from_every_surface_in_every_theme() {let style = scroll_style();diff --git a/docs/releasing.md b/docs/releasing.mdindex 842ab516..68930027 100644--- a/docs/releasing.md+++ b/docs/releasing.md@@ -46,6 +46,9 @@ Plus `SHA256SUMS.txt`.settings live in `CraftAnythingData\` (`crates/engine/src/settings.rs`).- **Flatpak** grants `--share=network` (AI backends, engine downloads) and `--filesystem=home:ro`(files to inspect, passed by path).-- **Fonts** are committed in `assets/fonts` (OFL-1.1). Every package ships their `OFL-*.txt`. The- shared craft-fonts input isn't used.+- **Fonts** are committed in `assets/fonts` (OFL-1.1). Release and CI builds also embed craft-fonts+ at the commit pinned in `release.yml` and `ci.yml` (`CRAFT_FONTS_DIR`, `CRAFT_FONTS_REQUIRED=1`),+ the fallbacks for Korean, Chinese, Japanese, Thai, Arabic, Hebrew, Devanagari and symbols; a+ build without them shows those as boxes (#19). Every package ships all their licences+ (`OFL-*.txt`, craft-fonts' as `OFL-<font>.txt`).- **The WiX UpgradeCode** `8F69A8B5-4384-479B-B3FF-93C5374BCA51` belongs to Craft Anything for good.diff --git a/packaging/env.sh b/packaging/env.shindex e39d4066..f5b2d6f8 100644--- a/packaging/env.sh+++ b/packaging/env.sh@@ -86,12 +86,16 @@ copy_docs() {copy_font_licences "$dest"}-# The app embeds the fonts in assets/fonts (OFL-1.1): ship their licences next to the binaries.+# The app embeds the fonts in assets/fonts (OFL-1.1) and, built with CRAFT_FONTS_DIR (releases),+# craft-fonts' too: ship their licences next to the binaries (craft-fonts' as OFL-<font>.txt).copy_font_licences() {local dest="$1" lic- for lic in "$ROOT"/assets/fonts/OFL-*.txt; do+ for lic in "$ROOT"/assets/fonts/OFL-*.txt "${CRAFT_FONTS_DIR:-/nonexistent}"/fonts/*/OFL.txt; do[ -f "$lic" ] || continue- cp "$lic" "$dest/"+ case "$lic" in+ */fonts/*/OFL.txt) cp "$lic" "$dest/OFL-$(basename "$(dirname "$lic")").txt" ;;+ *) cp "$lic" "$dest/" ;;+ esacdone}diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1index e356873f..f975e0e1 100644--- a/packaging/windows/package.ps1+++ b/packaging/windows/package.ps1@@ -162,8 +162,12 @@ foreach ($f in 'README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE'$p = Join-Path $Root $fif (Test-Path $p) { Copy-Item $p $Portable }}-# The embedded fonts (assets/fonts) are OFL-1.1: ship their licences.+# The embedded fonts (assets/fonts, and craft-fonts' with CRAFT_FONTS_DIR as releases build) are+# OFL-1.1: ship their licences, craft-fonts' as OFL-<font>.txt.Get-ChildItem -Path (Join-Path $Root 'assets\fonts') -Filter 'OFL-*.txt' -ErrorAction SilentlyContinue | ForEach-Object { Copy-Item $_.FullName $Portable }+if ($env:CRAFT_FONTS_DIR) {+ Get-ChildItem -Path (Join-Path $env:CRAFT_FONTS_DIR 'fonts\*\OFL.txt') -ErrorAction SilentlyContinue | ForEach-Object { Copy-Item $_.FullName (Join-Path $Portable "OFL-$($_.Directory.Name).txt") }+}# portable.txt beside craft-anything.exe switches on portable mode: settings, logs and the engine# store go to CraftAnythingData\ next to the exe instead of %APPDATA% (crates/engine/src/settings.rs).Copy-Item (Join-Path $PSScriptRoot 'portable.txt') $Portable