Skip to main content

CosmicTextSystem

Struct CosmicTextSystem 

Source
pub struct CosmicTextSystem(/* private fields */);

Implementations§

Source§

impl CosmicTextSystem

Source

pub fn font_weight_and_style( &self, font_id: FontId, ) -> Result<(FontWeight, FontStyle)>

Returns the selected face’s weight and style, which may differ from the request.

Source

pub fn missing_glyphs( &self, text: &str, font_runs: &[FontRun], missing_text_indices: impl IntoIterator<Item = usize>, ) -> Vec<MissingGlyph>

Builds reports for unresolved source indices after an outer text system has applied its own fallback.

Source

pub fn new(system_font_fallback: &str) -> Self

Source

pub fn new_without_system_fonts(system_font_fallback: &str) -> Self

Trait Implementations§

Source§

impl PlatformTextSystem for CosmicTextSystem

Source§

fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()>

Source§

fn set_missing_glyph_sink(&self, sink: Option<Arc<dyn MissingGlyphSink>>)

Installs a nonblocking sink for unresolved grapheme clusters.
Source§

fn all_font_names(&self) -> Vec<String>

Get all available font names.
Source§

fn font_id(&self, font: &Font) -> Result<FontId>

Get the font ID for a font descriptor.
Source§

fn prewarm_fonts(&self, font_ids: &[FontId])

Prewarm any system font caches needed to shape text.
Source§

fn font_metrics(&self, font_id: FontId) -> FontMetrics

Get metrics for a font.
Source§

fn typographic_bounds( &self, font_id: FontId, glyph_id: GlyphId, ) -> Result<Bounds<f32>>

Get typographic bounds for a glyph.
Source§

fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>>

Get the advance width for a glyph.
Source§

fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId>

Get the glyph ID for a character.
Source§

fn glyph_raster_bounds( &self, params: &RenderGlyphParams, ) -> Result<Bounds<DevicePixels>>

Get raster bounds for a glyph.
Source§

fn rasterize_glyph( &self, params: &RenderGlyphParams, raster_bounds: Bounds<DevicePixels>, ) -> Result<(Size<DevicePixels>, Vec<u8>)>

Rasterize a glyph.
Source§

fn layout_line( &self, text: &str, font_size: Pixels, runs: &[FontRun], ) -> LineLayout

Layout a line of text with the given font runs.
Source§

fn recommended_rendering_mode( &self, _font_id: FontId, _font_size: Pixels, ) -> TextRenderingMode

Returns the recommended text rendering mode for the given font and size.
Source§

fn glyph_dilation_for_color(&self, _color: Hsla) -> u8

Returns the dilation level to use for a glyph painted in the given color.

Auto Trait Implementations§

§

impl !Freeze for CosmicTextSystem

§

impl !RefUnwindSafe for CosmicTextSystem

§

impl !UnwindSafe for CosmicTextSystem

§

impl Forget for CosmicTextSystem

§

impl Move for CosmicTextSystem

§

impl Send for CosmicTextSystem
where RwLock<RawRwLock, CosmicTextSystemState>: Send,

§

impl Sync for CosmicTextSystem
where RwLock<RawRwLock, CosmicTextSystemState>: Sync,

§

impl Unpin for CosmicTextSystem
where Align8<usize>: Unpin, *const u8 is !null: Unpin, NonZero<u32>: Unpin, Arc<dyn AsRef<[u8]> + Send + Sync>: Unpin, Arc<Font>: Unpin, &'static str: Unpin, Arc<str>: Unpin, Arc<Vec<FontMatchKey>>: Unpin, u8: Unpin, &'static hb_ot_shaper_t: Unpin, Box<dyn Any + Send + Sync>: Unpin, *const Feature is !null: Unpin, Feature: Unpin, InternalBitFlags: Unpin, InternalBitFlags: Unpin, *const LeafNode<MonospaceFallbackInfo, SetValZST> is !null: Unpin, Box<(MonospaceFallbackInfo, SetValZST)>: Unpin, Box<dyn Fallback>: Unpin, Box<HintInstance>: Unpin, Arc<GlyphStyleMap>: Unpin, Arc<RwLock<Vec<Option<UnscaledStyleMetrics>>>>: Unpin, Arc<[(FontId, SharedString)]>: Unpin, Arc<Vec<(String, u32)>>: Unpin, Arc<Vec<String>>: Unpin, *const FontId is !null: Unpin, FontId: Unpin, Arc<dyn MissingGlyphSink>: Unpin,

§

impl UnsafeUnpin for CosmicTextSystem
where Align8<usize>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<Slot<FaceInfo>>: UnsafeUnpin, PhantomData<fn(InnerId) -> InnerId>: UnsafeUnpin, PhantomData<fn() -> FxHasher>: UnsafeUnpin, PhantomData<((ID, Weight), Option<Arc<Font>>)>: UnsafeUnpin, PhantomData<ID>: UnsafeUnpin, PhantomData<([u8; 4], Vec<ID>)>: UnsafeUnpin, PhantomData<(ID, FontCachedCodepointSupportInfo)>: UnsafeUnpin, PhantomData<(FontMatchAttrs, Arc<Vec<FontMatchKey>>)>: UnsafeUnpin, PhantomData<(ID, hb_ot_shape_plan_t)>: UnsafeUnpin, InternalBitFlags: UnsafeUnpin, PhantomData<GlyphInfo>: UnsafeUnpin, PhantomData<GlyphPosition>: UnsafeUnpin, PhantomData<BitPage>: UnsafeUnpin, PhantomData<PageInfo>: UnsafeUnpin, PhantomData<Script>: UnsafeUnpin, PhantomData<ShapeSpan>: UnsafeUnpin, PhantomData<ShapeWord>: UnsafeUnpin, PhantomData<VisualLine>: UnsafeUnpin, PhantomData<Vec<LayoutGlyph>>: UnsafeUnpin, *const LeafNode<MonospaceFallbackInfo, SetValZST> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(MonospaceFallbackInfo, SetValZST)>>: UnsafeUnpin, *const dyn Fallback is !null: UnsafeUnpin, PhantomData<dyn Fallback>: UnsafeUnpin, PhantomData<&'static str>: UnsafeUnpin, PhantomData<(Script, Range<usize>)>: UnsafeUnpin, PhantomData<Entry<ScalerProxy>>: UnsafeUnpin, PhantomData<LayerData>: UnsafeUnpin, PhantomData<Vector>: UnsafeUnpin, PhantomData<Verb>: UnsafeUnpin, PhantomData<Segment>: UnsafeUnpin, PhantomData<Cell>: UnsafeUnpin, PhantomData<i32>: UnsafeUnpin, PhantomData<HintingEntry>: UnsafeUnpin, PhantomData<F2Dot14>: UnsafeUnpin, PhantomData<(RenderGlyphParams, Image)>: UnsafeUnpin, PhantomData<LoadedFont>: UnsafeUnpin, PhantomData<(LoadedFontKey, FontId)>: UnsafeUnpin, PhantomData<(FontKey, SmallVec<[FontId; 4]>)>: UnsafeUnpin, *const ArcInner<dyn MissingGlyphSink> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn MissingGlyphSink>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more