Creates a new font by loading the fonts from a byte array
(bytes: Vec<u8>)
| 66 | /// Creates a new font by loading the fonts from a byte array |
| 67 | /// |
| 68 | pub fn from_bytes(bytes: Vec<u8>) -> Arc<CanvasFontFace> { |
| 69 | // Pin the data for this font face |
| 70 | let data = bytes.into_boxed_slice(); |
| 71 | Arc::new(Self::from_pinned(Arc::new(data.into()), 0)) |
| 72 | } |
| 73 | |
| 74 | #[cfg(not(feature = "outline-fonts"))] |
| 75 | fn from_pinned(data: Arc<Pin<Box<[u8]>>>, _font_index: u32) -> CanvasFontFace { |