Skip to content

Commit

Permalink
Rename FontFamily::VariableWidth to FontFamily::Proportional
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Dec 27, 2020
1 parent 53ab2f4 commit 847f67c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions egui/src/paint/fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)]
Expand Down Expand Up @@ -152,7 +152,7 @@ impl FontDefinitions {
],
);
fonts_for_family.insert(
FontFamily::VariableWidth,
FontFamily::Proportional,
vec![
"Ubuntu-Light".to_owned(),
"NotoEmoji-Regular".to_owned(),
Expand All @@ -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 {
Expand Down

0 comments on commit 847f67c

Please sign in to comment.