mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Add subpixel_binning to TextOptions and FontTweak (#8072)
This lets you turn off subpixel horizontal binning of glyphs. The option is a trade-off between even kerning and sharp text. * Closes https://github.com/emilk/egui/issues/8034
This commit is contained in:
@@ -34,6 +34,20 @@ pub struct TextOptions {
|
||||
///
|
||||
/// Default is `true`.
|
||||
pub font_hinting: bool,
|
||||
|
||||
/// Enable sub-pixel binning for glyphs.
|
||||
///
|
||||
/// Sub-pixel binning renders each glyph at up to four fractional horizontal offsets,
|
||||
/// giving more even kerning at the cost of more atlas space.
|
||||
///
|
||||
/// It also lead to text looking more blurry.
|
||||
///
|
||||
/// This is always disabled for CJK characters (which have too many unique glyphs).
|
||||
///
|
||||
/// Can be overridden per font with [`FontTweak::subpixel_binning`].
|
||||
///
|
||||
/// Default: `true`.
|
||||
pub subpixel_binning: bool,
|
||||
}
|
||||
|
||||
impl Default for TextOptions {
|
||||
@@ -42,6 +56,7 @@ impl Default for TextOptions {
|
||||
max_texture_side: 2048, // Small but portable
|
||||
alpha_from_coverage: crate::AlphaFromCoverage::default(),
|
||||
font_hinting: true,
|
||||
subpixel_binning: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user