Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace default font #22

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion OFL.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright 2011 The Comfortaa Project Authors (https://github.com/alexeiva/comfortaa), with Reserved Font Name "Comfortaa".
Copyright (c) 2009-2012, Vernon Adams ([email protected])
https://github.com/KDE/oxygen-fonts

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,4 @@ Egui is under MIT OR Apache-2.0 license.

Fonts:

* Comfortaa: Open Font License, see OFT.txt
* ProggyClean.ttf, Copyright (c) 2004, 2005 Tristan Grimmer. MIT License. <http://www.proggyfonts.net/>
* Roboto-Regular.ttf: Apache License, Version 2.0
* Oxygen: Open Font License, see OFL.txt
Binary file removed egui/fonts/Comfortaa-Regular.ttf
Binary file not shown.
Binary file removed egui/fonts/DejaVuSans.ttf
Binary file not shown.
Binary file removed egui/fonts/DejaVuSansMono.ttf
Binary file not shown.
Binary file added egui/fonts/Oxygen-Regular.ttf
Binary file not shown.
Binary file added egui/fonts/OxygenMono-Regular.ttf
Binary file not shown.
Binary file removed egui/fonts/ProggyClean.ttf
Binary file not shown.
Binary file removed egui/fonts/Roboto-Regular.ttf
Binary file not shown.
13 changes: 4 additions & 9 deletions egui/src/paint/fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ impl Default for FontDefinitions {
impl FontDefinitions {
pub fn with_pixels_per_point(pixels_per_point: f32) -> Self {
let mut fonts = BTreeMap::new();
fonts.insert(TextStyle::Body, (FontFamily::VariableWidth, 14.0));
fonts.insert(TextStyle::Body, (FontFamily::VariableWidth, 15.0));
fonts.insert(TextStyle::Button, (FontFamily::VariableWidth, 16.0));
fonts.insert(TextStyle::Heading, (FontFamily::VariableWidth, 24.0));
fonts.insert(TextStyle::Monospace, (FontFamily::Monospace, 13.0));
fonts.insert(TextStyle::Monospace, (FontFamily::Monospace, 14.0));

Self {
pixels_per_point,
Expand Down Expand Up @@ -97,13 +97,8 @@ impl Fonts {
let atlas = Arc::new(Mutex::new(atlas));

// TODO: figure out a way to make the WASM smaller despite including a font. Zip it?
let monospace_typeface_data = include_bytes!("../../fonts/ProggyClean.ttf"); // Use 13 for this. NOTHING ELSE.

// let monospace_typeface_data = include_bytes!("../../fonts/Roboto-Regular.ttf");

let variable_typeface_data = include_bytes!("../../fonts/Comfortaa-Regular.ttf"); // Funny, hard to read

// let variable_typeface_data = include_bytes!("../../fonts/DejaVuSans.ttf"); // Basic, boring, takes up more space
let monospace_typeface_data = include_bytes!("../../fonts/OxygenMono-Regular.ttf");
let variable_typeface_data = include_bytes!("../../fonts/Oxygen-Regular.ttf");

self.definitions = definitions.clone();
let FontDefinitions {
Expand Down