pub struct CosmicTextSystem(/* private fields */);Expand description
基于 cosmic-text 的文本系统实现
Implementations§
Trait Implementations§
Source§impl PlatformTextSystem for CosmicTextSystem
impl PlatformTextSystem for CosmicTextSystem
fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()>
Source§fn all_font_names(&self) -> Vec<String>
fn all_font_names(&self) -> Vec<String>
获取所有可用字体名称
Source§fn font_metrics(&self, font_id: FontId) -> FontMetrics
fn font_metrics(&self, font_id: FontId) -> FontMetrics
获取字体度量信息
Source§fn typographic_bounds(
&self,
font_id: FontId,
glyph_id: GlyphId,
) -> Result<Bounds<f32>>
fn typographic_bounds( &self, font_id: FontId, glyph_id: GlyphId, ) -> Result<Bounds<f32>>
获取字形的排版边界
Source§fn glyph_raster_bounds(
&self,
params: &RenderGlyphParams,
) -> Result<Bounds<DevicePixels>>
fn glyph_raster_bounds( &self, params: &RenderGlyphParams, ) -> Result<Bounds<DevicePixels>>
获取字形的栅格边界
Source§fn rasterize_glyph(
&self,
params: &RenderGlyphParams,
raster_bounds: Bounds<DevicePixels>,
) -> Result<(Size<DevicePixels>, Vec<u8>)>
fn rasterize_glyph( &self, params: &RenderGlyphParams, raster_bounds: Bounds<DevicePixels>, ) -> Result<(Size<DevicePixels>, Vec<u8>)>
栅格化字形
Source§fn layout_line(
&self,
text: &str,
font_size: Pixels,
runs: &[FontRun],
) -> LineLayout
fn layout_line( &self, text: &str, font_size: Pixels, runs: &[FontRun], ) -> LineLayout
使用给定的字体运行信息布局一行文本
Source§fn recommended_rendering_mode(
&self,
_font_id: FontId,
_font_size: Pixels,
) -> TextRenderingMode
fn recommended_rendering_mode( &self, _font_id: FontId, _font_size: Pixels, ) -> TextRenderingMode
返回给定字体和大小的推荐文本渲染模式
Source§fn glyph_dilation_for_color(&self, _color: Hsla) -> u8
fn glyph_dilation_for_color(&self, _color: Hsla) -> u8
返回使用给定颜色绘制字形时应使用的膨胀级别
Auto Trait Implementations§
impl !Freeze for CosmicTextSystem
impl !RefUnwindSafe for CosmicTextSystem
impl Send for CosmicTextSystem
impl Sync for CosmicTextSystem
impl Unpin for CosmicTextSystem
impl UnsafeUnpin for CosmicTextSystem
impl !UnwindSafe for CosmicTextSystem
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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