Struct cosmic_text::BorrowedWithFontSystem
source · pub struct BorrowedWithFontSystem<'a, T> { /* private fields */ }
Expand description
A value borrowed together with an FontSystem
Struct cosmic_text::BorrowedWithFontSystem
source · pub struct BorrowedWithFontSystem<'a, T> { /* private fields */ }
Expand description
A value borrowed together with an FontSystem
Implementations§
source§impl<'a> BorrowedWithFontSystem<'a, Buffer>
impl<'a> BorrowedWithFontSystem<'a, Buffer>
sourcepub fn shape_until_cursor(&mut self, cursor: Cursor, prune: bool)
pub fn shape_until_cursor(&mut self, cursor: Cursor, prune: bool)
Shape lines until cursor, also scrolling to include cursor in view
sourcepub fn shape_until_scroll(&mut self, prune: bool)
pub fn shape_until_scroll(&mut self, prune: bool)
Shape lines until scroll
sourcepub fn line_shape(&mut self, line_i: usize) -> Option<&ShapeLine>
pub fn line_shape(&mut self, line_i: usize) -> Option<&ShapeLine>
Shape the provided line index and return the result
@@ -59,7 +59,7 @@§Panics
) -> TGet the internal Buffer
, mutably
sourcepub fn shape_as_needed(&mut self, prune: bool)
pub fn shape_as_needed(&mut self, prune: bool)
Shape lines until scroll, after adjusting scroll if the cursor moved
Trait Implementations§
source§impl<'a, T: Debug> Debug for BorrowedWithFontSystem<'a, T>
impl<'a, T: Debug> Debug for BorrowedWithFontSystem<'a, T>
source§impl<'a, T> Deref for BorrowedWithFontSystem<'a, T>
impl<'a, T> Deref for BorrowedWithFontSystem<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for BorrowedWithFontSystem<'a, T>
impl<'a, T> !RefUnwindSafe for BorrowedWithFontSystem<'a, T>
impl<'a, T> Send for BorrowedWithFontSystem<'a, T>where
+
Trait Implementations§
source§impl<'a, T: Debug> Debug for BorrowedWithFontSystem<'a, T>
impl<'a, T: Debug> Debug for BorrowedWithFontSystem<'a, T>
source§impl<'a, T> Deref for BorrowedWithFontSystem<'a, T>
impl<'a, T> Deref for BorrowedWithFontSystem<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for BorrowedWithFontSystem<'a, T>
impl<'a, T> !RefUnwindSafe for BorrowedWithFontSystem<'a, T>
impl<'a, T> Send for BorrowedWithFontSystem<'a, T>where
T: Send,
impl<'a, T> Sync for BorrowedWithFontSystem<'a, T>where
T: Sync,
impl<'a, T> Unpin for BorrowedWithFontSystem<'a, T>
impl<'a, T> !UnwindSafe for BorrowedWithFontSystem<'a, T>
Blanket Implementations§
source§impl<T> Borrow<T> for Twhere
diff --git a/cosmic_text/struct.FontSystem.html b/cosmic_text/struct.FontSystem.html
index c8dbfc0c83..324e847849 100644
--- a/cosmic_text/struct.FontSystem.html
+++ b/cosmic_text/struct.FontSystem.html
@@ -1,6 +1,6 @@
FontSystem in cosmic_text - Rust
Struct cosmic_text::FontSystem
source · pub struct FontSystem { /* private fields */ }
Expand description
Access to the system fonts.
-Implementations§
source§impl FontSystem
sourcepub fn new() -> Self
Create a new FontSystem
, that allows access to any installed system fonts
+Implementations§
source§impl FontSystem
sourcepub fn new() -> Self
Create a new FontSystem
, that allows access to any installed system fonts
§Timing
This function takes some time to run. On the release build, it can take up to a second,
while debug builds can take up to ten times longer. For this reason, it should only be
@@ -11,16 +11,16 @@
§Timing
sourcepub fn into_locale_and_db(self) -> (String, Database)
Consume this FontSystem
and return the locale and database.
-sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
-sourcepub fn is_monospace(&self, id: ID) -> bool
sourcepub fn get_monospace_ids_for_scripts(
+
sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
+sourcepub fn is_monospace(&self, id: ID) -> bool
sourcepub fn get_monospace_ids_for_scripts(
&self,
scripts: impl Iterator<Item = [u8; 4]>
-) -> Vec<ID>
sourcepub fn get_font_supported_codepoints_in_word(
+) -> Vec<ID>
sourcepub fn get_font_supported_codepoints_in_word(
&mut self,
id: ID,
word: &str
-) -> Option<usize>
sourcepub fn get_font_matches(&mut self, attrs: Attrs<'_>) -> Arc<Vec<FontMatchKey>>
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for FontSystem
§impl !RefUnwindSafe for FontSystem
§impl Send for FontSystem
§impl Sync for FontSystem
§impl Unpin for FontSystem
§impl !UnwindSafe for FontSystem
Blanket Implementations§
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for FontSystem
§impl !RefUnwindSafe for FontSystem
§impl Send for FontSystem
§impl Sync for FontSystem
§impl Unpin for FontSystem
§impl !UnwindSafe for FontSystem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/src/cosmic_text/font/system.rs.html b/src/cosmic_text/font/system.rs.html
index 9348041c0f..83b456b43d 100644
--- a/src/cosmic_text/font/system.rs.html
+++ b/src/cosmic_text/font/system.rs.html
@@ -412,6 +412,9 @@ Files
410
411
412
+413
+414
+415
use crate::{Attrs, Font, FontMatchAttrs, HashMap, ShapePlanCache};
use alloc::string::String;
use alloc::sync::Arc;
@@ -630,18 +633,21 @@ Files
pub fn cache_fonts(&mut self, mut ids: Vec<fontdb::ID>) {
#[cfg(feature = "std")]
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
- ids = ids
- .into_iter()
- .filter(|id| {
- let contains = self.font_cache.contains_key(id);
- if !contains {
- unsafe {
- self.db.make_shared_face_data(*id);
+ #[cfg(feature = "std")]
+ {
+ ids = ids
+ .into_iter()
+ .filter(|id| {
+ let contains = self.font_cache.contains_key(id);
+ if !contains {
+ unsafe {
+ self.db.make_shared_face_data(*id);
+ }
}
- }
- !contains
- })
- .collect::<_>();
+ !contains
+ })
+ .collect::<_>();
+ }
#[cfg(feature = "std")]
let fonts = ids.par_iter();
impl<T> Borrow<T> for Twhere
diff --git a/cosmic_text/struct.FontSystem.html b/cosmic_text/struct.FontSystem.html
index c8dbfc0c83..324e847849 100644
--- a/cosmic_text/struct.FontSystem.html
+++ b/cosmic_text/struct.FontSystem.html
@@ -1,6 +1,6 @@
FontSystem in cosmic_text - Rust
Struct cosmic_text::FontSystem
source · pub struct FontSystem { /* private fields */ }
Expand description
Access to the system fonts.
-Implementations§
source§impl FontSystem
sourcepub fn new() -> Self
Create a new FontSystem
, that allows access to any installed system fonts
+Implementations§
source§impl FontSystem
sourcepub fn new() -> Self
Create a new FontSystem
, that allows access to any installed system fonts
§Timing
This function takes some time to run. On the release build, it can take up to a second,
while debug builds can take up to ten times longer. For this reason, it should only be
@@ -11,16 +11,16 @@
§Timing
sourcepub fn into_locale_and_db(self) -> (String, Database)
Consume this FontSystem
and return the locale and database.
-sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
-sourcepub fn is_monospace(&self, id: ID) -> bool
sourcepub fn get_monospace_ids_for_scripts(
+
sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
+sourcepub fn is_monospace(&self, id: ID) -> bool
sourcepub fn get_monospace_ids_for_scripts(
&self,
scripts: impl Iterator<Item = [u8; 4]>
-) -> Vec<ID>
sourcepub fn get_font_supported_codepoints_in_word(
+) -> Vec<ID>
sourcepub fn get_font_supported_codepoints_in_word(
&mut self,
id: ID,
word: &str
-) -> Option<usize>
sourcepub fn get_font_matches(&mut self, attrs: Attrs<'_>) -> Arc<Vec<FontMatchKey>>
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for FontSystem
§impl !RefUnwindSafe for FontSystem
§impl Send for FontSystem
§impl Sync for FontSystem
§impl Unpin for FontSystem
§impl !UnwindSafe for FontSystem
Blanket Implementations§
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for FontSystem
§impl !RefUnwindSafe for FontSystem
§impl Send for FontSystem
§impl Sync for FontSystem
§impl Unpin for FontSystem
§impl !UnwindSafe for FontSystem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/src/cosmic_text/font/system.rs.html b/src/cosmic_text/font/system.rs.html
index 9348041c0f..83b456b43d 100644
--- a/src/cosmic_text/font/system.rs.html
+++ b/src/cosmic_text/font/system.rs.html
@@ -412,6 +412,9 @@ Files
410
411
412
+413
+414
+415
use crate::{Attrs, Font, FontMatchAttrs, HashMap, ShapePlanCache};
use alloc::string::String;
use alloc::sync::Arc;
@@ -630,18 +633,21 @@ Files
pub fn cache_fonts(&mut self, mut ids: Vec<fontdb::ID>) {
#[cfg(feature = "std")]
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
- ids = ids
- .into_iter()
- .filter(|id| {
- let contains = self.font_cache.contains_key(id);
- if !contains {
- unsafe {
- self.db.make_shared_face_data(*id);
+ #[cfg(feature = "std")]
+ {
+ ids = ids
+ .into_iter()
+ .filter(|id| {
+ let contains = self.font_cache.contains_key(id);
+ if !contains {
+ unsafe {
+ self.db.make_shared_face_data(*id);
+ }
}
- }
- !contains
- })
- .collect::<_>();
+ !contains
+ })
+ .collect::<_>();
+ }
#[cfg(feature = "std")]
let fonts = ids.par_iter();
Struct cosmic_text::FontSystem
source · pub struct FontSystem { /* private fields */ }
Expand description
Access to the system fonts.
-Implementations§
source§impl FontSystem
impl FontSystem
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new FontSystem
, that allows access to any installed system fonts
Implementations§
source§impl FontSystem
impl FontSystem
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new FontSystem
, that allows access to any installed system fonts
§Timing
This function takes some time to run. On the release build, it can take up to a second, while debug builds can take up to ten times longer. For this reason, it should only be @@ -11,16 +11,16 @@
§Timing
sourcepub fn into_locale_and_db(self) -> (String, Database)
pub fn into_locale_and_db(self) -> (String, Database)
Consume this FontSystem
and return the locale and database.
sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
pub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
-pub fn is_monospace(&self, id: ID) -> bool
pub fn get_monospace_ids_for_scripts( +
sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
pub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
+pub fn is_monospace(&self, id: ID) -> bool
pub fn get_monospace_ids_for_scripts( &self, scripts: impl Iterator<Item = [u8; 4]> -) -> Vec<ID>
pub fn get_font_supported_codepoints_in_word( +) -> Vec<ID>
pub fn get_font_supported_codepoints_in_word( &mut self, id: ID, word: &str -) -> Option<usize>
pub fn get_font_matches(&mut self, attrs: Attrs<'_>) -> Arc<Vec<FontMatchKey>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FontSystem
impl !RefUnwindSafe for FontSystem
impl Send for FontSystem
impl Sync for FontSystem
impl Unpin for FontSystem
impl !UnwindSafe for FontSystem
Blanket Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FontSystem
impl !RefUnwindSafe for FontSystem
impl Send for FontSystem
impl Sync for FontSystem
impl Unpin for FontSystem
impl !UnwindSafe for FontSystem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> From<T> for T
impl<T> From<T> for T
source§fn from(t: T) -> T
fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/src/cosmic_text/font/system.rs.html b/src/cosmic_text/font/system.rs.html index 9348041c0f..83b456b43d 100644 --- a/src/cosmic_text/font/system.rs.html +++ b/src/cosmic_text/font/system.rs.html @@ -412,6 +412,9 @@Files
use crate::{Attrs, Font, FontMatchAttrs, HashMap, ShapePlanCache};
use alloc::string::String;
use alloc::sync::Arc;
@@ -630,18 +633,21 @@ Files