mirror of
https://github.com/slint-ui/slint.git
synced 2025-12-23 09:19:32 +00:00
- Bundle translations for WASM/Android only (not for native builds) - Load Noto Sans CJK fonts dynamically from GitHub at runtime - Implement register_font_from_memory() with Result<FontHandle, RegisterFontError> - Make API automatically available with std feature (no explicit feature flag needed) - Export load_font_from_bytes() for WASM font loading from JavaScript - Change from wasm_bindgen(start) to explicit main() call for better control Fonts are loaded before app initialization to ensure proper CJK text rendering across all major browsers without bundling font files. Native builds load translations from lang/ directory at runtime. WASM/Android builds bundle translations at compile time and detect browser/system language automatically. API is now available when std feature is enabled, since we always have fontique with std. No need for experimental-register-font feature.
11 lines
450 B
Rust
11 lines
450 B
Rust
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
fn main() {
|
|
let mut config = slint_build::CompilerConfiguration::new();
|
|
let target = std::env::var("TARGET").unwrap();
|
|
if target.contains("android") || target.contains("wasm32") {
|
|
config = config.with_bundled_translations(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/"));
|
|
}
|
|
slint_build::compile_with_config("gallery.slint", config).unwrap();
|
|
}
|