From 847f67c8353684b3b04268246e012a15d065801e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 27 Dec 2020 14:19:20 +0100 Subject: [PATCH] Rename FontFamily::VariableWidth to FontFamily::Proportional --- CHANGELOG.md | 4 ++++ egui/src/paint/fonts.rs | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d11ca6f4..707a2585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Changed 🔧 + +* Renamed `FontFamily::VariableWidth` to `FontFamily::Proportional`. + ### Fixed 🐛 * `RepaintSignal` now implements `Sync` so it can be sent to a background thread. diff --git a/egui/src/paint/fonts.rs b/egui/src/paint/fonts.rs index df5b744b..dc2a77ea 100644 --- a/egui/src/paint/fonts.rs +++ b/egui/src/paint/fonts.rs @@ -43,14 +43,14 @@ impl TextStyle { } } -/// Which style of font: [`Monospace`][`FontFamily::Monospace`] or [`VariableWidth`][`FontFamily::VariableWidth`]. +/// Which style of font: [`Monospace`][`FontFamily::Monospace`] or [`Proportional`][`FontFamily::Proportional`]. #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] // #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum FontFamily { /// A font where each character is the same width (`w` is the same width as `i`). Monospace, /// A font where some characters are wider than other (e.g. 'w' is wider than 'i'). - VariableWidth, + Proportional, } /// The data of a `.ttf` or `.otf` file. @@ -76,7 +76,7 @@ fn rusttype_font_from_font_data(name: &str, data: &FontData) -> rusttype::Font<' /// // Large button text: /// fonts.family_and_size.insert( /// egui::TextStyle::Button, -/// (egui::FontFamily::VariableWidth, 32.0)); +/// (egui::FontFamily::Proportional, 32.0)); /// ctx.set_fonts(fonts); /// ``` #[derive(Clone, Debug, PartialEq)] @@ -152,7 +152,7 @@ impl FontDefinitions { ], ); fonts_for_family.insert( - FontFamily::VariableWidth, + FontFamily::Proportional, vec![ "Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned(), @@ -164,14 +164,14 @@ impl FontDefinitions { #[cfg(not(feature = "default_fonts"))] { fonts_for_family.insert(FontFamily::Monospace, vec![]); - fonts_for_family.insert(FontFamily::VariableWidth, vec![]); + fonts_for_family.insert(FontFamily::Proportional, vec![]); } let mut family_and_size = BTreeMap::new(); - family_and_size.insert(TextStyle::Small, (FontFamily::VariableWidth, 10.0)); - family_and_size.insert(TextStyle::Body, (FontFamily::VariableWidth, 14.0)); - family_and_size.insert(TextStyle::Button, (FontFamily::VariableWidth, 16.0)); - family_and_size.insert(TextStyle::Heading, (FontFamily::VariableWidth, 20.0)); + family_and_size.insert(TextStyle::Small, (FontFamily::Proportional, 10.0)); + family_and_size.insert(TextStyle::Body, (FontFamily::Proportional, 14.0)); + family_and_size.insert(TextStyle::Button, (FontFamily::Proportional, 16.0)); + family_and_size.insert(TextStyle::Heading, (FontFamily::Proportional, 20.0)); family_and_size.insert(TextStyle::Monospace, (FontFamily::Monospace, 13.0)); // 13 for `ProggyClean` Self {