feat: support for monospace system font

Provides support for the `monospacedSystemFontOfSize` method
from `NSFont`.

Refer: https://developer.apple.com/documentation/appkit/nsfont/3042659-monospacedsystemfontofsize?language=objc
This commit is contained in:
Esteban Borai 2022-08-31 17:02:44 -04:00
parent 1ad51887a4
commit d5f8b0d6e5

View file

@ -40,6 +40,14 @@ impl Font {
Font(unsafe { ShareId::from_ptr(msg_send![class!(NSFont), boldSystemFontOfSize: size]) })
}
/// Creates and returns a monospace system font at the specified size and weight
pub fn monospace(size: f64, weight: f64) -> Self {
let size = size as CGFloat;
let weight = weight as CGFloat;
Font(unsafe { ShareId::from_ptr(msg_send![class!(NSFont), monospacedSystemFontOfSize: size weight: weight]) })
}
}
impl Deref for Font {