1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Try out the Radio Canada font

This commit is contained in:
Emil Ernerfeldt
2026-06-24 12:00:07 -07:00
parent 7c600b3c76
commit bf3a973b5c
15 changed files with 126 additions and 170 deletions

View File

@@ -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 <https://fonts.google.com/specimen/Ubuntu> to compare to a ground truth.
/// When experimenting, use <https://fonts.google.com/specimen/Radio+Canada> to compare to a ground truth.
///
/// See <https://hikogui.org/2022/10/24/the-trouble-with-anti-aliasing.html> for related analysis.
#[derive(Clone, Copy, Debug, Default, PartialEq)]

View File

@@ -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}'
)
}

View File

@@ -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. <http://jslegers.github.io/emoji-icon-font/>:
@@ -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",