We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a212c30 commit 1ee1d06Copy full SHA for 1ee1d06
1 file changed
plotters/src/style/font/ttf.rs
@@ -76,14 +76,13 @@ impl Drop for FontExt {
76
impl FontExt {
77
fn new(font: Font) -> Self {
78
let handle = font.handle();
79
- let (data, idx) = match handle.as_ref() {
80
- Some(Handle::Memory { bytes, font_index }) => (&bytes[..], *font_index),
81
- _ => unreachable!(),
82
- };
83
- let face = unsafe {
84
- std::mem::transmute::<Option<_>, Option<Face<'static>>>(
85
- ttf_parser::Face::parse(data, idx).ok(),
86
- )
+ let face = match handle.as_ref() {
+ Some(Handle::Memory { bytes, font_index }) => unsafe {
+ std::mem::transmute::<Option<_>, Option<Face<'static>>>(
+ ttf_parser::Face::parse(bytes, *font_index).ok(),
+ )
+ },
+ _ => None,
87
};
88
Self { inner: font, face }
89
}
0 commit comments