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.
172 lines
5.9 KiB
TOML
172 lines
5.9 KiB
TOML
# Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
[package]
|
|
name = "i-slint-core"
|
|
description = "Internal Slint Runtime Library."
|
|
authors.workspace = true
|
|
documentation.workspace = true
|
|
edition = "2024"
|
|
homepage.workspace = true
|
|
keywords.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
rust-version.workspace = true
|
|
version.workspace = true
|
|
categories = ["gui", "development-tools", "no-std"]
|
|
|
|
[lib]
|
|
path = "lib.rs"
|
|
|
|
[features]
|
|
ffi = ["dep:static_assertions"] # Expose C ABI
|
|
libm = ["num-traits/libm", "euclid/libm", "zeno?/libm"]
|
|
# Allow the viewer to query at runtime information about item types
|
|
rtti = []
|
|
# Use the standard library
|
|
std = [
|
|
"euclid/std",
|
|
"once_cell/std",
|
|
"dep:scoped-tls-hkt",
|
|
"dep:lyon_path",
|
|
"dep:lyon_algorithms",
|
|
"dep:lyon_geom",
|
|
"dep:lyon_extra",
|
|
"dep:auto_enums",
|
|
"dep:web-time",
|
|
"image-decoders",
|
|
"svg",
|
|
"raw-window-handle-06?/std",
|
|
"zeno?/std",
|
|
"chrono/std",
|
|
"chrono/wasmbind",
|
|
"chrono/clock",
|
|
"dep:sys-locale",
|
|
"dep:webbrowser",
|
|
"shared-fontique",
|
|
]
|
|
# Unsafe feature meaning that there is only one core running and all thread_local are static.
|
|
# You can only enable this feature if you are sure that any API of this crate is only called
|
|
# from a single core, and not in a interrupt or signal handler.
|
|
unsafe-single-threaded = []
|
|
|
|
unicode = ["unicode-script", "unicode-linebreak"]
|
|
|
|
software-renderer-systemfonts = ["shared-fontique", "dep:skrifa", "fontdue", "software-renderer", "shared-parley"]
|
|
software-renderer-path = ["dep:zeno"]
|
|
software-renderer = ["bytemuck"]
|
|
|
|
image-decoders = ["dep:image", "dep:clru"]
|
|
image-default-formats = ["image?/default-formats"]
|
|
svg = ["dep:resvg"]
|
|
|
|
box-shadow-cache = []
|
|
|
|
shared-fontique = ["i-slint-common/shared-fontique"]
|
|
|
|
raw-window-handle-06 = ["dep:raw-window-handle-06"]
|
|
|
|
experimental = []
|
|
|
|
experimental-rich-text = ["dep:pulldown-cmark", "dep:htmlparser", "dep:thiserror", "i-slint-common/color-parsing"]
|
|
|
|
unstable-wgpu-26 = ["dep:wgpu-26"]
|
|
unstable-wgpu-27 = ["dep:wgpu-27"]
|
|
|
|
tr = ["dep:tr"]
|
|
|
|
32-bit-color = []
|
|
default = ["std", "unicode"]
|
|
|
|
shared-parley = ["shared-fontique", "dep:parley", "dep:skrifa"]
|
|
|
|
[dependencies]
|
|
i-slint-common = { workspace = true, features = ["default"] }
|
|
i-slint-core-macros = { workspace = true, features = ["default"] }
|
|
|
|
const-field-offset = { version = "0.1.5", path = "../../helper_crates/const-field-offset" }
|
|
vtable = { workspace = true }
|
|
|
|
portable-atomic = { version = "1", features = ["critical-section"] }
|
|
auto_enums = { version = "0.8.0", optional = true }
|
|
cfg-if = "1"
|
|
derive_more = { workspace = true, features = ["error"] }
|
|
euclid = { workspace = true }
|
|
lyon_algorithms = { version = "1.0", optional = true }
|
|
lyon_geom = { version = "1.0", optional = true }
|
|
lyon_path = { version = "1.0", optional = true }
|
|
lyon_extra = { version = "1.0.1", optional = true }
|
|
num-traits = { version = "0.2", default-features = false }
|
|
once_cell = { version = "1.5", default-features = false, features = ["critical-section"] }
|
|
pin-project = "1"
|
|
pin-weak = { version = "1.1", default-features = false }
|
|
# Note: the rgb version is extracted in ci.yaml for rustdoc builds
|
|
rgb = "0.8.27"
|
|
scoped-tls-hkt = { version = "0.1", optional = true }
|
|
scopeguard = { version = "1.1.0", default-features = false }
|
|
slab = { version = "0.4.3", default-features = false }
|
|
static_assertions = { version = "1.1", optional = true }
|
|
strum = { workspace = true }
|
|
unicode-segmentation = { workspace = true }
|
|
unicode-linebreak = { version = "0.1.5", optional = true }
|
|
unicode-script = { version = "0.5.7", optional = true }
|
|
integer-sqrt = { version = "0.1.5" }
|
|
bytemuck = { workspace = true, optional = true, features = ["derive"] }
|
|
zeno = { version = "0.3.3", optional = true, default-features = false, features = ["eval"] }
|
|
sys-locale = { version = "0.3.2", optional = true, features = ["js"] }
|
|
parley = { version = "0.6.0", optional = true }
|
|
pulldown-cmark = { version = "0.13.0", optional = true }
|
|
|
|
image = { workspace = true, optional = true, default-features = false }
|
|
clru = { workspace = true, optional = true }
|
|
|
|
resvg = { workspace = true, optional = true }
|
|
serde = { workspace = true, optional = true }
|
|
|
|
raw-window-handle-06 = { workspace = true, optional = true }
|
|
bitflags = { version = "2.4.2" }
|
|
|
|
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
|
|
skrifa = { workspace = true, optional = true }
|
|
fontdue = { workspace = true, optional = true }
|
|
|
|
wgpu-26 = { workspace = true, optional = true }
|
|
wgpu-27 = { workspace = true, optional = true }
|
|
|
|
tr = { workspace = true, optional = true }
|
|
|
|
webbrowser = { version = "1.0.6", optional = true }
|
|
htmlparser = { version = "0.2.1", optional = true }
|
|
thiserror = { version = "2.0.17", optional = true }
|
|
|
|
[target.'cfg(target_family = "unix")'.dependencies]
|
|
gettext-rs = { version = "0.7.1", optional = true, features = ["gettext-system"] }
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
web-time = { version = "1.0", optional = true }
|
|
wasm-bindgen = { version = "0.2" }
|
|
web-sys = { workspace = true, features = ["HtmlImageElement", "Navigator"] }
|
|
|
|
|
|
[dev-dependencies]
|
|
slint = { path = "../../api/rs/slint", default-features = false, features = ["std", "compat-1-2"] }
|
|
i-slint-backend-testing = { path = "../backends/testing" }
|
|
rustybuzz = { workspace = true }
|
|
ttf-parser = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
tiny-skia = "0.11.0"
|
|
tokio = { version = "1.35", features = ["rt-multi-thread", "macros", "time", "net", "io-util"] }
|
|
async-compat = { version = "0.2.4" }
|
|
tempfile = { version = "3.12.0" }
|
|
fontique = { workspace = true }
|
|
|
|
[lints.rust]
|
|
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(slint_debug_property)", "cfg(cbindgen)", "cfg(slint_int_coord)"] }
|
|
|
|
[lints.clippy]
|
|
# Coord is an alias for f32 in most architectures, but not always, so the cast
|
|
# to f32 *is* necessary.
|
|
unnecessary_cast = { level = "allow" }
|
|
|
|
[package.metadata.docs.rs]
|
|
rustdoc-args = ["--generate-link-to-definition"]
|