Stabilize the sdf-fonts feature

Enable the SDF feature by default in our compiler binaries

(Still disabled by default for other users because it takes up compile
time for something they probably don't need)
This commit is contained in:
Olivier Goffart 2025-02-19 21:24:53 +01:00 committed by GitHub
parent 28f83c64e2
commit 1e814c9bdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 68 additions and 15 deletions

View file

@ -189,6 +189,24 @@ impl CompilerConfiguration {
config.translation_path_bundle = Some(path.into());
Self { config }
}
/// Configures the compiler to use Signed Distance Field (SDF) encoding for fonts.
///
/// This flag only takes effect when `embed_resources` is set to [`EmbedResourcesKind::EmbedForSoftwareRenderer`],
/// and requires the `sdf-fonts` cargo feature to be enabled.
///
/// [SDF](https://en.wikipedia.org/wiki/Signed_distance_function) reduces the binary size by
/// using an alternative representation for fonts, trading off some rendering quality
/// for a smaller binary footprint.
/// Rendering is slower and may result in slightly inferior visual output.
/// Use this on systems with limited flash memory.
#[cfg(feature = "sdf-fonts")]
#[must_use]
pub fn with_sdf_fonts(self, enable: bool) -> Self {
let mut config = self.config;
config.use_sdf_fonts = enable;
Self { config }
}
}
/// Error returned by the `compile` function