# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial

[package]
name = "i-slint-core"
description = "Internal Slint Runtime Library."
authors.workspace = true
documentation.workspace = true
edition.workspace = true
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 = [] # Expose C ABI
libm = ["num-traits/libm", "euclid/libm"]
# Allow the viewer to query at runtime information about item types
rtti = []
# Use the standard library
std = ["euclid/std", "once_cell/std", "scoped-tls-hkt", "lyon_path", "lyon_algorithms", "lyon_geom", "lyon_extra", "dep:web-time", "image-decoders", "svg"]
# 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-fontdb", "rustybuzz", "fontdue", "software-renderer"]
software-renderer = ["bytemuck"]
# This is under a feature flag because it is experimental feature.
software-renderer-rotation = []

image-decoders = ["dep:image", "dep:clru"]
svg = ["dep:resvg", "shared-fontdb"]

box-shadow-cache = []

shared-fontdb = ["i-slint-common/shared-fontdb"]

default = ["std", "unicode"]

[dependencies]
i-slint-common = { workspace = true, features = ["default"] }
i-slint-core-macros = { workspace = true, features = ["default"] }

const-field-offset = { version = "0.1", path = "../../helper_crates/const-field-offset" }
vtable = { workspace = true }

portable-atomic = { version = "1", features = ["critical-section"] }
auto_enums = "0.8.0"
cfg-if = "1"
derive_more = "0.99.5"
euclid = { version = "0.22.1", default-features = false }
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 = "1.1"
strum = { workspace = true }
unicode-segmentation = "1.8.0"
unicode-linebreak = { version = "0.1.2", optional = true }
unicode-script = { version = "0.5.3", optional = true }
integer-sqrt = { version = "0.1.5" }
bytemuck = { workspace = true, optional = true, features = ["derive"] }

image = { version = "0.24.0", optional = true, default-features = false, features = [ "png", "jpeg" ] }
clru = { version = "0.6.0", optional = true }

resvg = { workspace = true, optional = true }
fontdb = { workspace = true, optional = true }
serde = { version = "1.0.163", features = ["derive"], optional = true }

[target.'cfg(target_family = "unix")'.dependencies]
gettext-rs = { version = "0.7", 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 = { version = "0.3", features = [ "HtmlImageElement" ] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
fontdb = { workspace = true, optional = true, default-features = true }
rustybuzz = { version = "0.13.0", optional = true }
fontdue = { workspace = true, optional = true }

[dev-dependencies]
slint = { path = "../../api/rs/slint", default-features = false, features = ["std", "compat-1-2"] }
i-slint-backend-testing = { path="../backends/testing" }
rustybuzz = "0.13.0"
ttf-parser = "0.20.0"
fontdb = { workspace = true, default-features = true }
serde_json = "1.0.96"
tiny-skia = "0.11.0"
tokio = { version = "1.35", features = ["rt-multi-thread"] }