use crate::FontHandle;
use objc2_core_foundation::{CFRetained, CFString};
use objc2_core_text::CTFont;
use rustc_hash::FxHasher;
use std::hash::Hasher;
pub(crate) fn ct_font_face_id(font: &CTFont) -> u64 {
let psname: CFRetained<CFString> = unsafe { font.post_script_name() };
let s = psname.to_string();
let mut h = FxHasher::default();
h.write(s.as_bytes());
h.finish()
}
pub(crate) fn font_handle_from_ct_font(font: &CTFont, size_lpx: f32, scale: f32) -> FontHandle {
FontHandle::from_face_id(ct_font_face_id(font), size_lpx, scale)
}