diff --git a/README.md b/README.md index 45bd23f6d..bd385ed90 100644 --- a/README.md +++ b/README.md @@ -364,7 +364,7 @@ Default fonts: * `emoji-icon-font.ttf`: [Copyright (c) 2014 John Slegers](https://github.com/jslegers/emoji-icon-font) , MIT License * `Hack-Regular.ttf`: , [MIT Licence](https://github.com/source-foundry/Hack/blob/master/LICENSE.md) * `NotoEmoji-Regular.ttf`: [google.com/get/noto](https://google.com/get/noto), [SIL Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) -* `Ubuntu-Light.ttf` by [Dalton Maag](http://www.daltonmaag.com/): [Ubuntu font licence](https://ubuntu.com/legal/font-licence) +* `RadioCanada-VariableFont_wdth,wght.ttf` by [the Radio-Canada Project Authors](https://github.com/cbcrc/radiocanadafonts): [SIL Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) --- diff --git a/crates/egui_demo_lib/src/demo/font_book.rs b/crates/egui_demo_lib/src/demo/font_book.rs index 5144cd693..148b6b8b5 100644 --- a/crates/egui_demo_lib/src/demo/font_book.rs +++ b/crates/egui_demo_lib/src/demo/font_book.rs @@ -257,53 +257,6 @@ fn special_char_name(chr: char) -> Option<&'static str> { '\u{F1CA}' => Some("web-vine"), '\u{F8FF}' => Some("os-apple"), - // Special private-use-area extensions found in `Ubuntu-Light.ttf` - '\u{F000}' => Some("uniF000"), - '\u{F001}' => Some("fi"), - '\u{F002}' => Some("fl"), - '\u{F506}' => Some("one seventh"), - '\u{F507}' => Some("two sevenths"), - '\u{F508}' => Some("three sevenths"), - '\u{F509}' => Some("four sevenths"), - '\u{F50A}' => Some("five sevenths"), - '\u{F50B}' => Some("six sevenths"), - '\u{F50C}' => Some("one ninth"), - '\u{F50D}' => Some("two ninths"), - '\u{F50E}' => Some("four ninths"), - '\u{F50F}' => Some("five ninths"), - '\u{F510}' => Some("seven ninths"), - '\u{F511}' => Some("eight ninths"), - '\u{F800}' => Some("zero.alt"), - '\u{F801}' => Some("one.alt"), - '\u{F802}' => Some("two.alt"), - '\u{F803}' => Some("three.alt"), - '\u{F804}' => Some("four.alt"), - '\u{F805}' => Some("five.alt"), - '\u{F806}' => Some("six.alt"), - '\u{F807}' => Some("seven.alt"), - '\u{F808}' => Some("eight.alt"), - '\u{F809}' => Some("nine.alt"), - '\u{F80A}' => Some("zero.sups"), - '\u{F80B}' => Some("one.sups"), - '\u{F80C}' => Some("two.sups"), - '\u{F80D}' => Some("three.sups"), - '\u{F80E}' => Some("four.sups"), - '\u{F80F}' => Some("five.sups"), - '\u{F810}' => Some("six.sups"), - '\u{F811}' => Some("seven.sups"), - '\u{F812}' => Some("eight.sups"), - '\u{F813}' => Some("nine.sups"), - '\u{F814}' => Some("zero.sinf"), - '\u{F815}' => Some("one.sinf"), - '\u{F816}' => Some("two.sinf"), - '\u{F817}' => Some("three.sinf"), - '\u{F818}' => Some("four.sinf"), - '\u{F819}' => Some("five.sinf"), - '\u{F81A}' => Some("six.sinf"), - '\u{F81B}' => Some("seven.sinf"), - '\u{F81C}' => Some("eight.sinf"), - '\u{F81D}' => Some("nine.sinf"), - _ => None, } } diff --git a/crates/egui_kittest/tests/tests.rs b/crates/egui_kittest/tests/tests.rs index de22026a2..684354a4e 100644 --- a/crates/egui_kittest/tests/tests.rs +++ b/crates/egui_kittest/tests/tests.rs @@ -152,8 +152,9 @@ fn test_scroll_down() { let mut harness = test_scroll_harness(); let button = harness.get_by_label("Hidden Button"); - button.scroll_down(); - button.scroll_down(); + for _ in 0..10 { + button.scroll_down(); + } harness.run(); harness.get_by_label("Hidden Button").click(); @@ -174,7 +175,9 @@ fn test_masking() { .as_millis(); ui.label("I should not be masked."); - ui.label(format!("Timestamp: {timestamp}")); + // Render the timestamp with a monospace font so that the layout width + // does not depend on which digits the current time happens to contain. + ui.monospace(format!("Timestamp: {timestamp}")); ui.label("I should also not be masked."); }); diff --git a/crates/epaint/src/image.rs b/crates/epaint/src/image.rs index 6fbd2b38f..a21fbbfc5 100644 --- a/crates/epaint/src/image.rs +++ b/crates/epaint/src/image.rs @@ -362,7 +362,7 @@ impl std::fmt::Debug for ColorImage { /// (which would require more atlas space, but would allow for more accurate rendering of colored text and emojis), /// or do the color compensation in the shader, based on the active text color. /// -/// When experimenting, use to compare to a ground truth. +/// When experimenting, use to compare to a ground truth. /// /// See for related analysis. #[derive(Clone, Copy, Debug, Default, PartialEq)] diff --git a/crates/epaint/src/text/font.rs b/crates/epaint/src/text/font.rs index 987f271e0..d9bf4a104 100644 --- a/crates/epaint/src/text/font.rs +++ b/crates/epaint/src/text/font.rs @@ -460,10 +460,7 @@ impl FontFace { matches!( chr, // Strip out a religious symbol with secondary nefarious interpretation: - '\u{534d}' | '\u{5350}' | - - // Ignore ubuntu-specific stuff in `Ubuntu-Light.ttf`: - '\u{E0FF}' | '\u{EFFD}' | '\u{F0FF}' | '\u{F200}' + '\u{534d}' | '\u{5350}' ) } diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index 7c5f69988..193d44e69 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -17,7 +17,7 @@ use crate::{ use emath::{NumExt as _, OrderedFloat, Rangef}; #[cfg(feature = "default_fonts")] -use epaint_default_fonts::{EMOJI_ICON, HACK_REGULAR, NOTO_EMOJI_REGULAR, UBUNTU_LIGHT}; +use epaint_default_fonts::{EMOJI_ICON, HACK_REGULAR, NOTO_EMOJI_REGULAR, RADIO_CANADA}; // ---------------------------------------------------------------------------- @@ -306,7 +306,7 @@ fn blob_from_font_data(data: &FontData) -> Blob { /// fonts.font_data.insert("my_font".to_owned(), /// std::sync::Arc::new( /// // .ttf and .otf supported -/// FontData::from_static(include_bytes!("../../../epaint_default_fonts/fonts/Ubuntu-Light.ttf")) +/// FontData::from_static(include_bytes!("../../../epaint_default_fonts/fonts/RadioCanada-VariableFont_wdth,wght.ttf")) /// ) /// ); /// @@ -413,8 +413,13 @@ impl Default for FontDefinitions { ); font_data.insert( - "Ubuntu-Light".to_owned(), - Arc::new(FontData::from_static(UBUNTU_LIGHT)), + "Radio Canada".to_owned(), + // Radio Canada is a variable font; a slightly-lighter-than-regular weight + // looks best for UI text. + Arc::new(FontData::from_static(RADIO_CANADA).tweak(FontTweak { + coords: VariationCoords::new([(b"wght", 350.0), (b"wdth", 100.0)]), + ..Default::default() + })), ); // Bigger emojis, and more. : @@ -430,7 +435,7 @@ impl Default for FontDefinitions { FontFamily::Monospace, vec![ "Hack".to_owned(), - "Ubuntu-Light".to_owned(), // fallback for √ etc + "Radio Canada".to_owned(), // fallback for √ etc "NotoEmoji-Regular".to_owned(), "emoji-icon-font".to_owned(), ], @@ -438,7 +443,7 @@ impl Default for FontDefinitions { families.insert( FontFamily::Proportional, vec![ - "Ubuntu-Light".to_owned(), + "Radio Canada".to_owned(), "NotoEmoji-Regular".to_owned(), "emoji-icon-font".to_owned(), ], @@ -468,7 +473,7 @@ impl FontDefinitions { #[cfg(feature = "default_fonts")] pub fn builtin_font_names() -> &'static [&'static str] { &[ - "Ubuntu-Light", + "Radio Canada", "NotoEmoji-Regular", "emoji-icon-font", "Hack", diff --git a/crates/epaint_default_fonts/Cargo.toml b/crates/epaint_default_fonts/Cargo.toml index 43f6fedfe..13e0cb9f7 100644 --- a/crates/epaint_default_fonts/Cargo.toml +++ b/crates/epaint_default_fonts/Cargo.toml @@ -6,7 +6,7 @@ description = "Default fonts for use in epaint / egui" edition.workspace = true rust-version.workspace = true homepage = "https://github.com/emilk/egui/tree/main/crates/epaint_default_fonts" -license = "(MIT OR Apache-2.0) AND OFL-1.1 AND Ubuntu-font-1.0" # OFL and UFL are from the font files themselves. +license = "(MIT OR Apache-2.0) AND OFL-1.1" # OFL is from the font files themselves. readme = "README.md" repository = "https://github.com/emilk/egui/tree/main/crates/epaint_default_fonts" categories = ["graphics", "gui"] @@ -19,7 +19,7 @@ include = [ "fonts/*.ttf", "fonts/*.txt", "fonts/OFL.txt", - "fonts/UFL.txt", + "fonts/RadioCanada-OFL.txt", ] [lints] diff --git a/crates/epaint_default_fonts/fonts/RadioCanada-OFL.txt b/crates/epaint_default_fonts/fonts/RadioCanada-OFL.txt new file mode 100644 index 000000000..64814e32a --- /dev/null +++ b/crates/epaint_default_fonts/fonts/RadioCanada-OFL.txt @@ -0,0 +1,94 @@ +Copyright 2017 The Radio-Canada Project Authors (https://github.com/cbcrc/radiocanadafonts) + +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: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/epaint_default_fonts/fonts/RadioCanada-VariableFont_wdth,wght.ttf b/crates/epaint_default_fonts/fonts/RadioCanada-VariableFont_wdth,wght.ttf new file mode 100644 index 000000000..150e75e4b Binary files /dev/null and b/crates/epaint_default_fonts/fonts/RadioCanada-VariableFont_wdth,wght.ttf differ diff --git a/crates/epaint_default_fonts/fonts/UFL.txt b/crates/epaint_default_fonts/fonts/UFL.txt deleted file mode 100755 index ae78a8f94..000000000 --- a/crates/epaint_default_fonts/fonts/UFL.txt +++ /dev/null @@ -1,96 +0,0 @@ -------------------------------- -UBUNTU FONT LICENCE Version 1.0 -------------------------------- - -PREAMBLE -This licence allows the licensed fonts to be used, studied, modified and -redistributed freely. The fonts, including any derivative works, can be -bundled, embedded, and redistributed provided the terms of this licence -are met. The fonts and derivatives, however, cannot be released under -any other licence. The requirement for fonts to remain under this -licence does not require any document created using the fonts or their -derivatives to be published under this licence, as long as the primary -purpose of the document is not to be a vehicle for the distribution of -the fonts. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this licence and clearly marked as such. This may -include source files, build scripts and documentation. - -"Original Version" refers to the collection of Font Software components -as received under this licence. - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to -a new environment. - -"Copyright Holder(s)" refers to all individuals and companies who have a -copyright ownership of the Font Software. - -"Substantially Changed" refers to Modified Versions which can be easily -identified as dissimilar to the Font Software by users of the Font -Software comparing the Original Version with the Modified Version. - -To "Propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification and with or without charging -a redistribution fee), making available to the public, and in some -countries other activities as well. - -PERMISSION & CONDITIONS -This licence does not grant any rights under trademark law and all such -rights are reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to propagate the Font Software, subject to -the below conditions: - -1) Each copy of the Font Software must contain the above copyright -notice and this licence. These can be included either as stand-alone -text files, human-readable headers or in the appropriate machine- -readable metadata fields within text or binary files as long as those -fields can be easily viewed by the user. - -2) The font name complies with the following: -(a) The Original Version must retain its name, unmodified. -(b) Modified Versions which are Substantially Changed must be renamed to -avoid use of the name of the Original Version or similar names entirely. -(c) Modified Versions which are not Substantially Changed must be -renamed to both (i) retain the name of the Original Version and (ii) add -additional naming elements to distinguish the Modified Version from the -Original Version. The name of such Modified Versions must be the name of -the Original Version, with "derivative X" where X represents the name of -the new work, appended to that name. - -3) The name(s) of the Copyright Holder(s) and any contributor to the -Font Software shall not be used to promote, endorse or advertise any -Modified Version, except (i) as required by this licence, (ii) to -acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with -their explicit written permission. - -4) The Font Software, modified or unmodified, in part or in whole, must -be distributed entirely under this licence, and must not be distributed -under any other licence. The requirement for fonts to remain under this -licence does not affect any document created using the Font Software, -except any version of the Font Software extracted from a document -created using the Font Software may only be distributed under this -licence. - -TERMINATION -This licence becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/epaint_default_fonts/fonts/Ubuntu-Light.ttf b/crates/epaint_default_fonts/fonts/Ubuntu-Light.ttf deleted file mode 100755 index 0e9f90d7c..000000000 Binary files a/crates/epaint_default_fonts/fonts/Ubuntu-Light.ttf and /dev/null differ diff --git a/crates/epaint_default_fonts/src/lib.rs b/crates/epaint_default_fonts/src/lib.rs index f3dad7de8..226dd91e6 100644 --- a/crates/epaint_default_fonts/src/lib.rs +++ b/crates/epaint_default_fonts/src/lib.rs @@ -26,14 +26,15 @@ pub const HACK_REGULAR: &[u8] = include_bytes!("../fonts/Hack-Regular.ttf"); /// more information. pub const NOTO_EMOJI_REGULAR: &[u8] = include_bytes!("../fonts/NotoEmoji-Regular.ttf"); -/// A typeface designed for use by Ubuntu. +/// A contemporary sans serif typeface designed for user interfaces. /// -/// The Ubuntu typeface has been specially created to complement the Ubuntu tone -/// of voice. It has a contemporary style and contains characteristics unique to -/// the Ubuntu brand that convey a precise, reliable and free attitude. +/// Radio Canada was commissioned by CBC/Radio-Canada for clear, legible text on +/// screens. It is a variable font with weight and width axes, with a regular +/// weight as its default instance. /// -/// See [Ubuntu design](https://design.ubuntu.com/font) for more information. -pub const UBUNTU_LIGHT: &[u8] = include_bytes!("../fonts/Ubuntu-Light.ttf"); +/// See [the Radio Canada repository](https://github.com/cbcrc/radiocanadafonts) +/// for more information. +pub const RADIO_CANADA: &[u8] = include_bytes!("../fonts/RadioCanada-VariableFont_wdth,wght.ttf"); /// An experimental typeface that uses standardized /// [UNICODE planes](http://en.wikipedia.org/wiki/Plane_(Unicode)) diff --git a/deny.toml b/deny.toml index e926cdb19..a39dde746 100644 --- a/deny.toml +++ b/deny.toml @@ -89,7 +89,6 @@ allow = [ "MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11. Used by webpki-roots on Linux. "OFL-1.1", # https://spdx.org/licenses/OFL-1.1.html "OpenSSL", # https://www.openssl.org/source/license.html - used on Linux - "Ubuntu-font-1.0", # https://ubuntu.com/legal/font-licence "Unicode-3.0", # https://www.unicode.org/license.txt "Unicode-DFS-2016", # https://spdx.org/licenses/Unicode-DFS-2016.html "Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib) diff --git a/web_demo/index.html b/web_demo/index.html index b6047549e..9a7454f2c 100644 --- a/web_demo/index.html +++ b/web_demo/index.html @@ -59,7 +59,7 @@ transform: translate(-50%, -50%); color: #f0f0f0; font-size: 24px; - font-family: Ubuntu-Light, Helvetica, sans-serif; + font-family: "Radio Canada", Helvetica, sans-serif; text-align: center; } diff --git a/web_demo/multiple_apps.html b/web_demo/multiple_apps.html index 515c1497c..c3847af80 100644 --- a/web_demo/multiple_apps.html +++ b/web_demo/multiple_apps.html @@ -51,7 +51,7 @@ transform: translate(-50%, -50%); color: #f0f0f0; font-size: 24px; - font-family: Ubuntu-Light, Helvetica, sans-serif; + font-family: "Radio Canada", Helvetica, sans-serif; text-align: center; }