use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::attributed_string::{CFAttributedString, CFAttributedStringRef};
use core_foundation::base::{CFAllocatorRef, TCFType};
use core_foundation::boolean::CFBoolean;
use core_foundation::data::{CFData, CFDataRef};
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
use core_foundation::error::CFErrorRef;
use core_foundation::string::{CFString, CFStringRef};
use core_graphics::base::CGFloat;
use core_graphics::data_provider::CGDataProvider;
use core_graphics::font::CGFont;
use core_graphics::geometry::CGAffineTransform;
use core_graphics::sys::{CGContextRef, CGFontRef};
use core_text::font::{self, CTFont, CTFontRef};
use core_text::font_descriptor::{
self, kCTFontCascadeListAttribute, kCTFontFamilyNameAttribute, CTFontDescriptor,
};
use core_text::line::CTLine;
use core_text::string_attributes::{
kCTFontAttributeName, kCTForegroundColorFromContextAttributeName,
};
use foreign_types::ForeignType;
use std::collections::HashMap;
use std::sync::{Arc, Mutex, OnceLock};
use crate::testing::TextRun;
use crate::Rect;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct FontMetrics {
pub ascent: f64,
pub descent: f64,
pub leading: f64,
pub line_height: f64,
pub char_width: f64,
}
pub fn make_font(family: &str, size_pt: f64) -> Option<CTFont> {
font::new_from_name(family, size_pt).ok()
}
pub fn make_font_exact(family: &str, size_pt: f64) -> Option<CTFont> {
let requested = family.trim();
let font = make_font(requested, size_pt)?;
let matched = font.family_name().eq_ignore_ascii_case(requested)
|| font.postscript_name().eq_ignore_ascii_case(requested);
matched.then_some(font)
}
pub fn system_ui_font(size_pt: f64) -> CTFont {
font::new_ui_font_for_language(font::kCTFontSystemFontType, size_pt, None)
}
pub fn system_monospace_font(size_pt: f64) -> CTFont {
font::new_ui_font_for_language(font::kCTFontUserFixedPitchFontType, size_pt, None)
}
pub(crate) fn font_with_fallback(font: &CTFont, fallback_families: &[&str]) -> CTFont {
let cascade_key = unsafe { CFString::wrap_under_get_rule(kCTFontCascadeListAttribute) };
let entries: Vec<CTFontDescriptor> = fallback_families
.iter()
.map(|family| cascade_descriptor_for(family))
.collect();
let cascade_list = CFArray::from_CFTypes(&entries);
let attrs = CFDictionary::from_CFType_pairs(&[(cascade_key, cascade_list.as_CFType())]);
let desc = font_descriptor::new_from_attributes(&attrs);
let font_ref = unsafe {
CTFontCreateCopyWithAttributes(
font.as_concrete_TypeRef(),
0.0,
std::ptr::null(),
desc.as_concrete_TypeRef(),
)
};
unsafe { CTFont::wrap_under_create_rule(font_ref) }
}
pub(crate) fn font_with_builtin_fallback(
font: &CTFont,
app_fallback_family: Option<&str>,
) -> CTFont {
let mut families: Vec<&str> = Vec::with_capacity(2);
if let Some(family) = app_fallback_family {
families.push(family);
}
families.push(crate::codicon::FONT_FAMILY);
font_with_fallback(font, &families)
}
#[cfg(test)]
const REAL_FONT_GLYPH_COUNT_FLOOR: core_foundation::base::CFIndex = 64;
#[cfg(test)]
pub(crate) fn resolved_fallback_for_char(font: &CTFont, ch: char) -> (String, bool) {
let line = build_ctline(font, &ch.to_string());
let runs = line.glyph_runs();
let run = runs
.get(0)
.filter(|_| runs.len() == 1)
.expect("a single non-empty character always lays out as exactly one glyph run");
let attrs = run
.attributes()
.expect("a laid-out glyph run always carries attributes");
let resolved_font = attrs
.find(unsafe { CFString::wrap_under_get_rule(kCTFontAttributeName) })
.expect("a laid-out glyph run always carries a resolved NSFont attribute")
.downcast::<CTFont>()
.expect("the NSFont attribute on a CTRun is always a CTFont");
let family = resolved_font.family_name();
let resolved_real_glyph = resolved_font.glyph_count() > REAL_FONT_GLYPH_COUNT_FLOOR;
(family, resolved_real_glyph)
}
fn descriptor_for_family(family: &str) -> CTFontDescriptor {
let key = unsafe { CFString::wrap_under_get_rule(kCTFontFamilyNameAttribute) };
let attrs = CFDictionary::from_CFType_pairs(&[(key, CFString::new(family).as_CFType())]);
font_descriptor::new_from_attributes(&attrs)
}
static REGISTERED_FONT_DESCRIPTORS: OnceLock<Mutex<HashMap<String, CTFontDescriptor>>> =
OnceLock::new();
fn registered_font_descriptors() -> &'static Mutex<HashMap<String, CTFontDescriptor>> {
REGISTERED_FONT_DESCRIPTORS.get_or_init(|| Mutex::new(HashMap::new()))
}
fn remember_registered_descriptor(family: String, descriptor: &CTFontDescriptor) {
let owned = unsafe { CTFontDescriptor::wrap_under_get_rule(descriptor.as_concrete_TypeRef()) };
registered_font_descriptors()
.lock()
.expect("REGISTERED_FONT_DESCRIPTORS mutex should never be poisoned")
.insert(family, owned);
}
fn cascade_descriptor_for(family: &str) -> CTFontDescriptor {
let table = registered_font_descriptors()
.lock()
.expect("REGISTERED_FONT_DESCRIPTORS mutex should never be poisoned");
let exact = table.get(family).map(|descriptor| unsafe {
CTFontDescriptor::wrap_under_get_rule(descriptor.as_concrete_TypeRef())
});
drop(table);
exact.unwrap_or_else(|| descriptor_for_family(family))
}
pub fn register_font_from_memory(bytes: &[u8]) -> Option<String> {
let provider = CGDataProvider::from_buffer(Arc::new(bytes.to_vec()));
let cgfont = CGFont::from_data_provider(provider).ok()?;
let mut error: CFErrorRef = std::ptr::null_mut();
let registered = unsafe { CTFontManagerRegisterGraphicsFont(cgfont.as_ptr(), &mut error) };
if !registered {
return None;
}
let ctfont = font::new_from_CGFont(&cgfont, 12.0);
let family = ctfont.family_name();
let cf_data = CFData::from_buffer(bytes);
let descriptors_ref =
unsafe { CTFontManagerCreateFontDescriptorsFromData(cf_data.as_concrete_TypeRef()) };
if !descriptors_ref.is_null() {
let descriptors: CFArray<CTFontDescriptor> =
unsafe { TCFType::wrap_under_create_rule(descriptors_ref) };
if let Some(descriptor) = descriptors.get(0) {
if descriptor.family_name() == family {
remember_registered_descriptor(family.clone(), &descriptor);
}
}
}
Some(family)
}
pub(crate) fn ensure_codicon_registered() -> bool {
static REGISTERED: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*REGISTERED.get_or_init(|| register_font_from_memory(crate::codicon::FONT_BYTES).is_some())
}
pub fn font_metrics(font: &CTFont) -> FontMetrics {
let ascent = font.ascent();
let descent = font.descent();
let leading = font.leading();
let (char_width, _) = measure_text(font, "M");
FontMetrics {
ascent,
descent,
leading,
line_height: ascent + descent + leading,
char_width,
}
}
pub fn measure_text(font: &CTFont, text: &str) -> (f64, f64) {
let height = font.ascent() + font.descent() + font.leading();
if text.is_empty() {
return (0.0, height);
}
let line = build_ctline(font, text);
let bounds = line.get_typographic_bounds();
(bounds.width, height)
}
impl crate::primitives::layout_metrics::TextMeasure for CTFont {
fn width_of(&self, text: &str) -> f32 {
measure_text(self, text).0 as f32
}
}
pub unsafe fn draw_text(
ctx: CGContextRef,
font: &CTFont,
text: &str,
x: f64,
y: f64,
color: (f64, f64, f64, f64),
) {
draw_text_impl(ctx, font, text, x, y, 1.0, color)
}
pub unsafe fn draw_text_scaled_x(
ctx: CGContextRef,
font: &CTFont,
text: &str,
x: f64,
y: f64,
scale_x: f64,
color: (f64, f64, f64, f64),
) {
draw_text_impl(ctx, font, text, x, y, scale_x, color)
}
unsafe fn draw_text_impl(
ctx: CGContextRef,
font: &CTFont,
text: &str,
x: f64,
y: f64,
scale_x: f64,
color: (f64, f64, f64, f64),
) {
if text.is_empty() {
return;
}
record_if_active(font, text, x, y);
CGContextSaveGState(ctx);
CGContextSetRGBFillColor(ctx, color.0, color.1, color.2, color.3);
let flip = CGAffineTransform {
a: scale_x,
b: 0.0,
c: 0.0,
d: -1.0,
tx: 0.0,
ty: 0.0,
};
CGContextSetTextMatrix(ctx, flip);
let ascent = font.ascent();
CGContextSetTextPosition(ctx, x, y + ascent);
let line = build_ctline(font, text);
CTLineDraw(line.as_concrete_TypeRef(), ctx);
CGContextRestoreGState(ctx);
}
pub(crate) fn start_recording_text() {
let _ = crate::testing::install_text_run_sink();
}
pub(crate) fn stop_recording_text() -> Vec<TextRun> {
crate::testing::take_text_run_sink(None)
}
fn record_if_active(font: &CTFont, text: &str, x: f64, y: f64) {
if crate::testing::text_run_sink_active() {
let (w, h) = measure_text(font, text);
crate::testing::record_text_run(text, Rect::new(x as f32, y as f32, w as f32, h as f32));
}
}
fn build_ctline(font: &CTFont, text: &str) -> CTLine {
let font_key = unsafe { CFString::wrap_under_get_rule(kCTFontAttributeName) };
let from_ctx_key =
unsafe { CFString::wrap_under_get_rule(kCTForegroundColorFromContextAttributeName) };
let attributes = CFDictionary::from_CFType_pairs(&[
(font_key, font.as_CFType()),
(from_ctx_key, CFBoolean::true_value().as_CFType()),
]);
let cf_text = CFString::new(text);
let attr_ref: CFAttributedStringRef = unsafe {
CFAttributedStringCreate(
std::ptr::null(),
cf_text.as_concrete_TypeRef(),
attributes.as_concrete_TypeRef(),
)
};
let attr_string = unsafe { CFAttributedString::wrap_under_create_rule(attr_ref) };
CTLine::new_with_attributed_string(attr_string.as_concrete_TypeRef())
}
#[link(name = "CoreText", kind = "framework")]
extern "C" {
fn CTLineDraw(line: core_text::line::CTLineRef, context: CGContextRef);
fn CTFontCreateCopyWithAttributes(
font: CTFontRef,
size: CGFloat,
matrix: *const CGAffineTransform,
attributes: core_text::font_descriptor::CTFontDescriptorRef,
) -> CTFontRef;
fn CTFontManagerRegisterGraphicsFont(font: CGFontRef, error: *mut CFErrorRef) -> bool;
fn CTFontManagerCreateFontDescriptorsFromData(data: CFDataRef) -> CFArrayRef;
}
#[link(name = "CoreFoundation", kind = "framework")]
extern "C" {
fn CFAttributedStringCreate(
alloc: CFAllocatorRef,
str: CFStringRef,
attributes: CFDictionaryRef,
) -> CFAttributedStringRef;
}
extern "C" {
fn CGContextSaveGState(c: CGContextRef);
fn CGContextRestoreGState(c: CGContextRef);
fn CGContextSetRGBFillColor(
c: CGContextRef,
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
);
fn CGContextSetTextMatrix(c: CGContextRef, t: CGAffineTransform);
fn CGContextSetTextPosition(c: CGContextRef, x: CGFloat, y: CGFloat);
}
#[cfg(test)]
mod tests {
use super::*;
const TEST_FONT: &str = "Menlo";
const TEST_SIZE: f64 = 14.0;
fn font() -> CTFont {
make_font(TEST_FONT, TEST_SIZE).expect("Menlo should be installed on every macOS host")
}
#[test]
fn make_font_existing_returns_some() {
assert!(make_font("Menlo", 12.0).is_some());
}
#[test]
fn make_font_exact_rejects_an_unknown_family_that_make_font_substitutes() {
if let Some(substituted) = make_font("Definitely Not A Real Font Family", 12.0) {
assert_ne!(
substituted.family_name(),
"Definitely Not A Real Font Family",
"Core Text cannot have resolved a family that doesn't exist",
);
}
assert!(
make_font_exact("Definitely Not A Real Font Family", 12.0).is_none(),
"make_font_exact must reject the family Core Text substituted",
);
}
#[test]
fn make_font_exact_accepts_family_and_postscript_spellings() {
let by_family = make_font_exact("Menlo", TEST_SIZE).expect("Menlo by family name");
assert_eq!(by_family.family_name(), "Menlo");
assert_eq!(by_family.pt_size(), TEST_SIZE);
assert!(
make_font_exact("Menlo-Regular", TEST_SIZE).is_some(),
"PostScript spelling must count as an exact match",
);
assert!(make_font_exact(" Menlo ", TEST_SIZE).is_some());
}
#[test]
fn font_metrics_structure_consistent() {
let m = font_metrics(&font());
assert!(
m.ascent > 0.0,
"ascent should be positive, got {}",
m.ascent
);
assert!(
m.descent >= 0.0,
"descent should be non-negative, got {}",
m.descent
);
assert!(
m.leading >= 0.0,
"leading should be non-negative, got {}",
m.leading
);
let expected = m.ascent + m.descent + m.leading;
assert!(
(m.line_height - expected).abs() < 1e-9,
"line_height {} should equal ascent + descent + leading = {}",
m.line_height,
expected,
);
assert!(
m.line_height > 12.0 && m.line_height < 30.0,
"line_height {} out of plausible range for 14pt Menlo",
m.line_height,
);
}
#[test]
fn font_metrics_char_width_positive() {
let m = font_metrics(&font());
assert!(
m.char_width > 0.0 && m.char_width < TEST_SIZE * 2.0,
"char_width {} out of expected range for 14pt Menlo",
m.char_width,
);
}
#[test]
fn measure_text_empty_string() {
let (w, h) = measure_text(&font(), "");
assert_eq!(w, 0.0);
assert!(
h > 0.0,
"empty-string height should still report line height"
);
}
#[test]
fn measure_text_single_char_matches_char_width_for_monospace() {
let f = font();
let m = font_metrics(&f);
let (w, _) = measure_text(&f, "M");
assert!(
(w - m.char_width).abs() < 1e-6,
"single-char width {} should equal char_width {}",
w,
m.char_width,
);
}
#[test]
fn measure_text_scales_linearly_for_monospace() {
let f = font();
let (w1, _) = measure_text(&f, "x");
let (w10, _) = measure_text(&f, "xxxxxxxxxx");
let ratio = w10 / w1;
assert!(
(ratio - 10.0).abs() < 0.05,
"10× width ratio was {}, expected ~10 for monospace",
ratio,
);
}
#[test]
fn draw_text_records_nothing_when_not_recording() {
let surface = super::super::headless::BitmapSurface::new(64, 32);
unsafe {
draw_text(
surface.context_ptr(),
&font(),
"hello",
2.0,
3.0,
(1.0, 1.0, 1.0, 1.0),
);
}
assert!(stop_recording_text().is_empty());
}
#[test]
fn draw_text_records_bounds_while_recording() {
let surface = super::super::headless::BitmapSurface::new(64, 32);
start_recording_text();
unsafe {
draw_text(
surface.context_ptr(),
&font(),
"hi",
2.0,
3.0,
(1.0, 1.0, 1.0, 1.0),
);
}
let runs = stop_recording_text();
assert_eq!(runs.len(), 1, "exactly one draw_text call should record");
assert_eq!(runs[0].text, "hi");
assert_eq!(runs[0].bounds.x, 2.0);
assert_eq!(runs[0].bounds.y, 3.0);
let (w, h) = measure_text(&font(), "hi");
assert_eq!(runs[0].bounds.width, w as f32);
assert_eq!(runs[0].bounds.height, h as f32);
}
#[test]
fn draw_text_empty_string_records_nothing() {
let surface = super::super::headless::BitmapSurface::new(4, 4);
start_recording_text();
unsafe {
draw_text(
surface.context_ptr(),
&font(),
"",
0.0,
0.0,
(1.0, 1.0, 1.0, 1.0),
);
}
assert!(stop_recording_text().is_empty());
}
#[test]
fn stop_recording_text_without_start_is_empty_not_panicking() {
assert!(stop_recording_text().is_empty());
}
#[test]
fn font_with_fallback_attaches_a_cascade_list_attribute() {
let base = font();
let with_fallback = font_with_fallback(&base, &["Helvetica"]);
let attrs = with_fallback.copy_descriptor().attributes().to_untyped();
let cascade_key = unsafe { CFString::wrap_under_get_rule(kCTFontCascadeListAttribute) };
assert!(
attrs.contains_key(&cascade_key.as_CFTypeRef()),
"font_with_fallback's returned font must carry a cascade-list attribute"
);
}
#[test]
fn font_with_fallback_preserves_family_and_size() {
let base = font();
let with_fallback = font_with_fallback(&base, &["Helvetica"]);
assert_eq!(with_fallback.family_name(), base.family_name());
assert_eq!(with_fallback.pt_size(), base.pt_size());
}
#[test]
fn font_with_fallback_still_measures_ordinary_text() {
let base = font();
let with_fallback = font_with_fallback(&base, &["Helvetica"]);
let (w, h) = measure_text(&with_fallback, "hello");
assert!(
w > 0.0 && h > 0.0,
"measuring plain text through a font with a fallback attached must still work \
(w={w}, h={h})"
);
}
#[test]
fn nerd_font_fallback_resolves_pua_codepoints_before_and_after_icon_resize() {
let families = core_text::font_manager::copy_available_font_family_names();
let nerd_family = families
.iter()
.map(|f| f.to_string())
.find(|name| name.to_ascii_lowercase().contains("nerd font"));
let Some(nerd_family) = nerd_family else {
eprintln!(
"no installed font family contains \"Nerd Font\" — skipping \
(see this test's doc for why that's not a failure)"
);
return;
};
let base = font(); let with_fallback = font_with_fallback(&base, &[nerd_family.as_str()]);
let icon_size_px = crate::ActivityBarStyle::default().resolved_icon_size_px() as f64;
let icon_sized = with_fallback.clone_with_font_size(icon_size_px);
let codepoints = [
('\u{EAF0}', "Explorer"),
('\u{EA68}', "SourceControl"),
('\u{EB91}', "RunDebug"),
('\u{F002}', "Search"),
('\u{EAE6}', "Extensions"),
('\u{F0E5}', "AiChat"),
];
for (ch, label) in codepoints {
let (base_family, base_ok) = resolved_fallback_for_char(&base, ch);
assert!(
!base_ok,
"{label} (U+{:04X}) unexpectedly resolved a real glyph through bare \
{base_family:?} with no cascade attached — this negative control \
must fail, otherwise a pass below can't tell us the cascade did \
anything",
ch as u32,
);
let (family_before, ok_before) = resolved_fallback_for_char(&with_fallback, ch);
assert!(
ok_before,
"{label} (U+{:04X}) failed to resolve a real glyph *before* \
clone_with_font_size, through family {family_before:?} \
— the installed Nerd Font {nerd_family:?} should have \
covered it",
ch as u32,
);
assert_eq!(
family_before, nerd_family,
"{label} (U+{:04X}) resolved through {family_before:?} instead of \
the cascade's own {nerd_family:?} — some other installed font is \
squatting on this PUA codepoint, so this pass doesn't show \
font_with_fallback's cascade contributed anything",
ch as u32,
);
let (family_after, ok_after) = resolved_fallback_for_char(&icon_sized, ch);
assert!(
ok_after,
"{label} (U+{:04X}) failed to resolve a real glyph *after* \
clone_with_font_size, through family {family_after:?} \
— the activity-bar icon resize must not drop fallback \
coverage that worked before the resize",
ch as u32,
);
assert_eq!(
family_after, nerd_family,
"{label} (U+{:04X}) resolved through {family_after:?} instead of \
the cascade's own {nerd_family:?} after clone_with_font_size — the \
resize must preserve which family in the cascade covers this \
codepoint",
ch as u32,
);
}
}
#[test]
fn resolved_fallback_for_char_reports_no_real_glyph_for_bare_menlo_on_pua() {
let base = font();
let (family, resolved_real_glyph) = resolved_fallback_for_char(&base, '\u{EAF0}');
assert!(
!resolved_real_glyph,
"bare Menlo (no fallback cascade attached) unexpectedly resolved a \
real glyph for U+EAF0 through family {family:?} — this codepoint is \
outside Menlo's own coverage, so this must report no real glyph"
);
}
#[test]
fn register_font_from_memory_rejects_bytes_that_are_not_a_font() {
let garbage = [0u8; 64];
assert!(
register_font_from_memory(&garbage).is_none(),
"64 zero bytes are not a parseable font — must report None, not a fabricated family"
);
}
const ICON_FONT_BYTES: &[u8] = include_bytes!("../../tests/fixtures/vimcode-icons.ttf");
fn registered_icon_font_family() -> String {
static FAMILY: OnceLock<String> = OnceLock::new();
FAMILY
.get_or_init(|| {
register_font_from_memory(ICON_FONT_BYTES).expect(
"vimcode-icons.ttf is a well-formed font Core Graphics can parse — a \
`None` here would also fire if some other code path in this process \
already registered these same bytes under a duplicate PostScript name, \
but `registered_icon_font_family`'s whole point is to register them \
exactly once, so that isn't expected",
)
})
.clone()
}
fn icon_font_with_fallback() -> (CTFont, String) {
let family = registered_icon_font_family();
let base = font();
(font_with_fallback(&base, &[family.as_str()]), family)
}
#[test]
fn cascade_descriptor_for_pins_the_exact_registered_descriptor_not_a_name_lookup() {
let family = registered_icon_font_family();
let pinned = cascade_descriptor_for(&family);
let name_only = descriptor_for_family(&family);
assert_ne!(
pinned.as_CFType(),
name_only.as_CFType(),
"cascade_descriptor_for({family:?}) returned a descriptor identical to a bare \
family-name lookup — the exact descriptor register_font_from_memory stashed was \
never consulted, so a test that only checks resolved glyphs would pass even \
without the fix on a host with no competing font sharing this family name"
);
}
#[test]
fn icon_font_cascade_resolves_every_registered_pua_codepoint() {
let (with_fallback, family) = icon_font_with_fallback();
let bare = font();
let codepoints = [
('\u{EAF0}', "Explorer"),
('\u{EA68}', "SourceControl"),
('\u{EB91}', "RunDebug"),
('\u{F002}', "Search"),
('\u{EAE6}', "Extensions"),
('\u{F0E5}', "AiChat"),
];
for (ch, label) in codepoints {
let (bare_family, bare_ok) = resolved_fallback_for_char(&bare, ch);
assert!(
!bare_ok,
"{label} (U+{:04X}) unexpectedly resolved a real glyph through bare \
{bare_family:?} with no cascade attached, even after the icon font was \
registered process-wide — this negative control must fail, otherwise a \
pass below can't tell us the cascade did anything",
ch as u32,
);
let (resolved_family, resolved_real_glyph) =
resolved_fallback_for_char(&with_fallback, ch);
assert!(
resolved_real_glyph,
"{label} (U+{:04X}) resolved to {resolved_family:?} with no real glyph — \
Core Text painted Apple's placeholder instead of a glyph from the \
registered icon font",
ch as u32,
);
assert_eq!(
resolved_family, family,
"{label} (U+{:04X}) resolved through {resolved_family:?} instead of the \
registered icon font family {family:?} — some other font on this host \
shares that family name and is winning the cascade lookup",
ch as u32,
);
}
}
#[test]
fn icon_font_cascade_survives_icon_resize_clone() {
let (with_fallback, family) = icon_font_with_fallback();
let icon_size_px = crate::ActivityBarStyle::default().resolved_icon_size_px() as f64;
let icon_sized = with_fallback.clone_with_font_size(icon_size_px);
let bare = font();
let (bare_family, bare_ok) = resolved_fallback_for_char(&bare, '\u{EAF0}');
assert!(
!bare_ok,
"Explorer (U+EAF0) unexpectedly resolved a real glyph through bare \
{bare_family:?} with no cascade attached, even after the icon font was \
registered process-wide — this negative control must fail, otherwise a pass \
below can't tell us the cascade did anything",
);
let (resolved_family, resolved_real_glyph) =
resolved_fallback_for_char(&icon_sized, '\u{EAF0}');
assert!(
resolved_real_glyph,
"Explorer (U+EAF0) failed to resolve a real glyph after \
clone_with_font_size, through family {resolved_family:?} — the \
activity-bar icon resize must not drop cascade coverage that \
worked before the resize",
);
assert_eq!(
resolved_family, family,
"Explorer (U+EAF0) resolved through {resolved_family:?} instead of the \
registered icon font family {family:?} after clone_with_font_size",
);
}
}