diff --git a/Cargo.toml b/Cargo.toml index 0085826..4edf0ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,10 +7,14 @@ edition = "2018" [lib] crate-type = ["staticlib", "cdylib"] +[features] + +use_tolk = ["tolk", "tts/use_tolk"] + [dependencies] env_logger = "0.7" gdnative = "0.9" -tts = "0.9" +tts = "0.10" [target.'cfg(windows)'.dependencies] -tolk = ">= 0.2.1" +tolk = { version = ">= 0.2.1", optional = true } diff --git a/README.md b/README.md index 3277127..344c839 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This addon was primarily developed for the [Godot Accessibility addon](https://g Text-to-speech is complicated, and some features may not work everywhere. Most optional features have an associated boolean property used to determine if the feature is available. Further, while I do attempt to ensure that this addon works as well as possible on all platforms, there may be bugs, and pull requests are welcome. Known supported platforms include: * Windows - * Screen readers/SAPI via Tolk + * Screen readers/SAPI via Tolk (requires `use_tolk` Cargo feature) * WinRT * Linux via [Speech Dispatcher](https://freebsoft.org/speechd) * MacOS diff --git a/src/lib.rs b/src/lib.rs index 054a8ac..08e8955 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,13 +121,19 @@ impl TTS { .done(); builder .add_property("can_detect_screen_reader") - .with_getter(|_: &TTS, _| if cfg!(windows) { true } else { false }) + .with_getter(|_: &TTS, _| { + if cfg!(all(windows, features = "use_tolk")) { + true + } else { + false + } + }) .done(); #[allow(unreachable_code)] builder .add_property("has_screen_reader") .with_getter(|_: &TTS, _| { - #[cfg(windows)] + #[cfg(all(windows, features = "use_tolk"))] { let tolk = tolk::Tolk::new(); return tolk.detect_screen_reader().is_some();