1use std::rc::Rc;
2
3use wasm_bindgen::prelude::*;
4
5#[wasm_bindgen]
7#[derive(Clone, Debug, PartialEq)]
8pub struct FontFace {
9 data: Rc<Vec<u8>>,
11}
12
13#[wasm_bindgen]
14impl FontFace {
15 #[wasm_bindgen(constructor, return_description = "A new font face.")]
17 pub fn new(
18 #[wasm_bindgen(param_description = "The data of the font face.")]
19 data: Vec<u8>,
20 ) -> FontFace {
21 FontFace { data: Rc::new(data) }
22 }
23
24 #[wasm_bindgen(getter, return_description = "The data of the font face.")]
26 pub fn data(&self) -> Vec<u8> {
27 self.data.to_vec()
28 }
29
30 #[wasm_bindgen(js_name = clone)]
32 pub fn copy(&self) -> FontFace {
33 self.clone()
34 }
35}