From a0d348573a94415a0842b1e05b412065c2eaffc6 Mon Sep 17 00:00:00 2001 From: "zhuoxian.dzx" Date: Fri, 6 Dec 2024 14:44:59 +0800 Subject: [PATCH] fix: use load_full in arc_swap --- package.json | 2 +- src/font.rs | 4 ++-- src/wit.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5c1b0b3..6ad3c17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fontkit-rs", - "version": "0.0.14", + "version": "0.0.15-beta.2", "description": "Toolkit used to load, match, measure, and render texts", "main": "index.js", "directories": { diff --git a/src/font.rs b/src/font.rs index e8c9f8a..8906a0e 100644 --- a/src/font.rs +++ b/src/font.rs @@ -499,7 +499,7 @@ impl Font { pub fn face(&self, key: &FontKey) -> Result { self.load()?; - let buffer = self.buffer.load().clone(); + let buffer = self.buffer.load().to_vec(); let filters = Filter::from_key(key); let mut queue = self.variants.iter().collect::>(); for filter in filters { @@ -558,7 +558,7 @@ impl Font { pub struct StaticFace { key: FontKey, pub(crate) path: PathBuf, - pub(crate) buffer: Arc>, + pub(crate) buffer: Vec, #[borrows(buffer)] #[covariant] pub(crate) face: Face<'this>, diff --git a/src/wit.rs b/src/wit.rs index 481bea6..315d99e 100644 --- a/src/wit.rs +++ b/src/wit.rs @@ -14,7 +14,7 @@ impl fi::GuestFont for StaticFace { } fn buffer(&self) -> Vec { - self.borrow_buffer().as_ref().clone() + self.borrow_buffer().clone() } fn path(&self) -> String {