mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
Add freetype feature
Uses the upstream "imgui_freetype" to "Build font atlases using FreeType instead of stb_truetype (which is the default font rasterizer)" Closes #359
This commit is contained in:
parent
774f8f46a7
commit
fca87575fd
@ -18,7 +18,9 @@ chlorine = "1.0.7"
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
pkg-config = { version="0.3", optional=true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
wasm = []
|
wasm = []
|
||||||
|
freetype = ["pkg-config"]
|
||||||
|
|||||||
@ -48,6 +48,20 @@ fn main() -> io::Result<()> {
|
|||||||
build.define(key, *value);
|
build.define(key, *value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Freetype font rasterizer feature
|
||||||
|
if std::env::var_os("CARGO_FEATURE_FREETYPE").is_some() {
|
||||||
|
let freetype = pkg_config::Config::new().find("freetype2").unwrap();
|
||||||
|
for include in freetype.include_paths.iter() {
|
||||||
|
build.include(include);
|
||||||
|
}
|
||||||
|
build.define("IMGUI_ENABLE_FREETYPE", None);
|
||||||
|
println!("cargo:DEFINE_{}={}", "IMGUI_ENABLE_FREETYPE", "");
|
||||||
|
|
||||||
|
// imgui_freetype.cpp needs access to imgui.h
|
||||||
|
build.include(
|
||||||
|
manifest_dir.join("third-party/imgui/"));
|
||||||
|
}
|
||||||
|
|
||||||
let compiler = build.get_compiler();
|
let compiler = build.get_compiler();
|
||||||
// Avoid the if-supported flag functions for easy cases, as they're
|
// Avoid the if-supported flag functions for easy cases, as they're
|
||||||
// kinda costly.
|
// kinda costly.
|
||||||
|
|||||||
@ -9,4 +9,8 @@
|
|||||||
#include "./third-party/imgui/imgui_tables.cpp"
|
#include "./third-party/imgui/imgui_tables.cpp"
|
||||||
#include "./third-party/cimgui.cpp"
|
#include "./third-party/cimgui.cpp"
|
||||||
|
|
||||||
|
#ifdef IMGUI_ENABLE_FREETYPE
|
||||||
|
#include "./third-party/imgui/misc/freetype/imgui_freetype.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ parking_lot = "0.11"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
wasm = ["imgui-sys/wasm"]
|
wasm = ["imgui-sys/wasm"]
|
||||||
|
freetype = ["imgui-sys/freetype"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
memoffset = "0.6"
|
memoffset = "0.6"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user