Skip to content

Commit c6ee0db

Browse files
Add fontique as a font database alongside fontdb (#9379)
* Add fontique as a font database alongside fontdb * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 5105617 commit c6ee0db

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

internal/common/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ path = "lib.rs"
1919
[features]
2020
default = []
2121
shared-fontdb = ["dep:fontdb", "dep:libloading", "derive_more", "cfg-if", "dep:ttf-parser"]
22+
shared-fontique = ["dep:fontique"]
2223

2324
[dependencies]
2425
fontdb = { workspace = true, optional = true }
2526
ttf-parser = { workspace = true, optional = true }
2627
derive_more = { workspace = true, optional = true }
2728
cfg-if = { version = "1", optional = true }
29+
fontique = { version = "0.5.0", optional = true }
2830

2931
[target.'cfg(not(any(target_family = "windows", target_vendor = "apple", target_arch = "wasm32", target_os = "android")))'.dependencies]
3032
libloading = { version = "0.8.0", optional = true }

internal/common/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33

44
#![doc = include_str!("README.md")]
55
#![doc(html_logo_url = "https://slint.dev/logo/slint-logo-square-light.svg")]
6-
#![cfg_attr(not(feature = "shared-fontdb"), no_std)]
6+
#![cfg_attr(not(any(feature = "shared-fontdb", feature = "shared-fontique")), no_std)]
77

88
pub mod builtin_structs;
99
pub mod enums;
1010
pub mod key_codes;
1111

12+
#[cfg(feature = "shared-fontique")]
13+
pub mod sharedfontique;
14+
1215
#[cfg(feature = "shared-fontdb")]
1316
pub mod sharedfontdb;
1417

internal/common/sharedfontique.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright © SixtyFPS GmbH <[email protected]>
2+
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3+
4+
pub use fontique;
5+
6+
thread_local! {
7+
pub static COLLECTION: std::cell::RefCell<fontique::Collection> = Default::default()
8+
}

internal/core/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ unsafe-single-threaded = []
4848

4949
unicode = ["unicode-script", "unicode-linebreak"]
5050

51-
software-renderer-systemfonts = ["shared-fontdb", "rustybuzz", "fontdue", "software-renderer"]
51+
software-renderer-systemfonts = ["shared-fontdb", "shared-fontique", "rustybuzz", "fontdue", "software-renderer"]
5252
software-renderer = ["bytemuck"]
5353

5454
image-decoders = ["dep:image", "dep:clru"]
@@ -58,6 +58,7 @@ svg = ["dep:resvg", "shared-fontdb"]
5858
box-shadow-cache = []
5959

6060
shared-fontdb = ["i-slint-common/shared-fontdb"]
61+
shared-fontique = ["i-slint-common/shared-fontique"]
6162

6263
raw-window-handle-06 = ["dep:raw-window-handle-06"]
6364

internal/renderers/femtovg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ unstable-wgpu-26 = ["wgpu-26"]
2525
[dependencies]
2626
i-slint-core = { workspace = true, features = ["default", "box-shadow-cache", "shared-fontdb"] }
2727
i-slint-core-macros = { workspace = true, features = ["default"] }
28-
i-slint-common = { workspace = true, features = ["default"] }
28+
i-slint-common = { workspace = true, features = ["default", "shared-fontique"] }
2929

3030
const-field-offset = { version = "0.1", path = "../../../helper_crates/const-field-offset" }
3131

0 commit comments

Comments
 (0)