m90: Update modules/
use crate::prelude::*;
use crate::{scalar, Font, FontMgr, FourByteTag, Point, TextBlob};
-pub use run_handler::RunHandler;
use skia_bindings as sb;
use skia_bindings::{
RustRunHandler, SkShaper, SkShaper_BiDiRunIterator, SkShaper_FontRunIterator,
@@ -11,6 +10,8 @@ use std::ffi::CStr;
use std::marker::PhantomData;
use std::os::raw;
+pub use run_handler::RunHandler;
+
pub type Shaper = RefHandle<SkShaper>;
unsafe impl Send for Shaper {}
unsafe impl Sync for Shaper {}
@@ -21,13 +22,13 @@ impl NativeDrop for SkShaper {
}
}
-impl Default for RefHandle<SkShaper> {
+impl Default for Shaper {
fn default() -> Self {
Self::new(None)
}
}
-impl RefHandle<SkShaper> {
+impl Shaper {
pub fn new_primitive() -> Self {
Self::from_ptr(unsafe { sb::C_SkShaper_MakePrimitive() }).unwrap()
}
@@ -50,13 +51,21 @@ impl RefHandle<SkShaper> {
})
}
- pub fn new(font_mgr: impl Into<Option<FontMgr>>) -> Self {
- Self::from_ptr(unsafe { sb::C_SkShaper_Make(font_mgr.into().into_ptr_or_null()) }).unwrap()
+ pub fn purge_harf_buzz_cache() {
+ unsafe { sb::SkShaper_PurgeHarfBuzzCache() }
}
pub fn new_core_text() -> Option<Self> {
Self::from_ptr(unsafe { sb::C_SkShaper_MakeCoreText() })
}
+
+ pub fn new(font_mgr: impl Into<Option<FontMgr>>) -> Self {
+ Self::from_ptr(unsafe { sb::C_SkShaper_Make(font_mgr.into().into_ptr_or_null()) }).unwrap()
+ }
+
+ pub fn purge_caches() {
+ unsafe { sb::SkShaper_PurgeCaches() }
+ }
}
pub use skia_bindings::SkShaper_Feature as Feature;
