forked from servo/font-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
instead of servo-fontconfig servo-fontconfig statically links a vendored fontconfig library if fontconfig is not found by pkgconfig. Using a vendored fontconfig library instead of the system fontconfig library doesn't actually work well though: slint-ui/slint#88 Building a vendored copy of fontconfig is also problematic because fontconfig has a lot of C dependencies, which makes it difficult to cross compile the vendored copy of fontconfig: $ pkg-config fontconfig --static --libs -lfontconfig -lfreetype -lz -lbz2 -lpng16 -lm -lm -lz -lharfbuzz -lm -lglib-2.0 -lm -lpcre -lsysprof-capture-4 -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lxml2 -lz -llzma -lm Instead of using a vendored copy, with yeslogic/fontconfig-rs#12 yeslogic-fontconfig-sys will have a Cargo feature to dlopen fontconfig at runtime instead of linking it at build time. This is exposed in font-kit with the new source-fontconfig-dlopen feature, which is disabled by default. The feature can be enabled by setting the RUST_FONTCONFIG_DLOPEN environment variable to avoid needing to propagate the Cargo feature all the way through downstream Cargo.toml's. This feature makes it considerably easier to cross compile by avoiding the need to cross compile fontconfig and all its dependencies.
- Loading branch information
Showing
3 changed files
with
140 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "font-kit" | ||
version = "0.10.1" | ||
version = "0.11.0" | ||
authors = ["Patrick Walton <[email protected]>"] | ||
description = "A cross-platform font loading library" | ||
license = "MIT/Apache-2.0" | ||
|
@@ -14,7 +14,8 @@ edition = "2018" | |
default = ["source"] | ||
loader-freetype = ["freetype"] | ||
loader-freetype-default = ["loader-freetype"] | ||
source-fontconfig = ["servo-fontconfig"] | ||
source-fontconfig = ["yeslogic-fontconfig-sys"] | ||
source-fontconfig-dlopen = ["yeslogic-fontconfig-sys/dlopen"] | ||
source-fontconfig-default = ["source-fontconfig"] | ||
source = [] | ||
|
||
|
@@ -32,8 +33,8 @@ pathfinder_simd = "0.5.1" | |
version = "0.7" | ||
optional = true | ||
|
||
[dependencies.servo-fontconfig] | ||
version = "0.5" | ||
[dependencies.yeslogic-fontconfig-sys] | ||
version = "3.0.0" | ||
optional = true | ||
|
||
[dev-dependencies] | ||
|
@@ -58,7 +59,7 @@ core-text = "19.1.0" | |
freetype = "0.7" | ||
|
||
[target.'cfg(not(any(target_family = "windows", target_os = "macos", target_os = "ios", target_arch = "wasm32")))'.dependencies] | ||
servo-fontconfig = "0.5" | ||
yeslogic-fontconfig-sys = "3.0.0" | ||
|
||
[target.'cfg(not(any(target_arch = "wasm32", target_family = "windows", target_os = "android")))'.dependencies] | ||
dirs-next = "2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn main() { | ||
println!("cargo:rerun-if-env-changed=RUST_FONTCONFIG_DLOPEN"); | ||
let dlopen = std::env::var("RUST_FONTCONFIG_DLOPEN").is_ok(); | ||
if dlopen { | ||
println!("cargo:rustc-cfg=feature=\"source-fontconfig-dlopen\""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters