pub struct ParleyTextSystem { /* private fields */ }Expand description
Experimental flat-LTR backend with an opt-in paragraph path. Select fonts before constructing GPUI; GPUI owns the font-metric, line-layout, wrapping and final raster caches.
Implementations§
Source§impl ParleyTextSystem
impl ParleyTextSystem
Sourcepub fn new(
fonts: FontContext,
default_family: impl Into<String>,
) -> Result<Self>
pub fn new( fonts: FontContext, default_family: impl Into<String>, ) -> Result<Self>
Use an existing Parley font context and an explicit application default.
.SystemUIFont maps to this family; native system-family discovery is not
implied. FontContext system discovery requires the system-fonts feature.
Sourcepub fn set_layout_error_handler(&self, handler: LayoutErrorHandler)
pub fn set_layout_error_handler(&self, handler: LayoutErrorHandler)
Replace the rejection diagnostic (default: stderr). Rejections remain
fallible through try_layout_line; only GPUI’s infallible hook substitutes.
Sourcepub fn try_layout_line(
&self,
text: &str,
size: Pixels,
runs: &[FontRun],
) -> Result<LineLayout>
pub fn try_layout_line( &self, text: &str, size: Pixels, runs: &[FontRun], ) -> Result<LineLayout>
Fallible equivalent of the infallible GPUI layout hook. Validate unsupported input here before using the backend through GPUI (RTL, synthetic styles, paragraph breaks and invalid style ranges return errors).
Sourcepub fn prepare_paragraph(
&self,
text: &str,
size: Pixels,
runs: &[FontRun],
) -> Result<ParagraphShape>
pub fn prepare_paragraph( &self, text: &str, size: Pixels, runs: &[FontRun], ) -> Result<ParagraphShape>
Extension-only prototype, automatic base direction, one logical paragraph. U+2028 is a hard line break; document/paragraph separators are rejected. Reuses backend contexts/face registry. GPUI owns paragraph caching through the optional PlatformTextSystem hook; this method itself adds no cache.
Sourcepub fn prepare_paragraph_with_options(
&self,
text: &str,
size: Pixels,
runs: &[FontRun],
options: ParagraphOptions,
) -> Result<ParagraphShape>
pub fn prepare_paragraph_with_options( &self, text: &str, size: Pixels, runs: &[FontRun], options: ParagraphOptions, ) -> Result<ParagraphShape>
Like Self::prepare_paragraph, with an explicit base direction and
content language. The language applies to the whole paragraph and selects
language-specific shaping and line breaking where fonts support it.
Trait Implementations§
Source§impl PlatformTextSystem for ParleyTextSystem
impl PlatformTextSystem for ParleyTextSystem
fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()>
Source§fn set_missing_glyph_sink(&self, sink: Option<Arc<dyn MissingGlyphSink>>)
fn set_missing_glyph_sink(&self, sink: Option<Arc<dyn MissingGlyphSink>>)
Source§fn all_font_names(&self) -> Vec<String>
fn all_font_names(&self) -> Vec<String>
Source§fn font_capabilities(&self) -> FontCapabilities
fn font_capabilities(&self) -> FontCapabilities
Source§fn font_table(
&self,
id: FontId,
tag: FontTag,
) -> Result<FontQuery<Option<Vec<u8>>>>
fn font_table( &self, id: FontId, tag: FontTag, ) -> Result<FontQuery<Option<Vec<u8>>>>
font_id. Read moreSource§fn font_metrics(&self, id: FontId) -> FontMetrics
fn font_metrics(&self, id: FontId) -> FontMetrics
Source§fn typographic_bounds(&self, id: FontId, glyph: GlyphId) -> Result<Bounds<f32>>
fn typographic_bounds(&self, id: FontId, glyph: GlyphId) -> Result<Bounds<f32>>
Source§fn advance(&self, id: FontId, glyph: GlyphId) -> Result<Size<f32>>
fn advance(&self, id: FontId, glyph: GlyphId) -> Result<Size<f32>>
Source§fn glyph_for_char(&self, id: FontId, ch: char) -> Option<GlyphId>
fn glyph_for_char(&self, id: FontId, ch: char) -> Option<GlyphId>
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,
bounds: Bounds<DevicePixels>,
) -> Result<(Size<DevicePixels>, Vec<u8>)>
fn rasterize_glyph( &self, params: &RenderGlyphParams, bounds: Bounds<DevicePixels>, ) -> Result<(Size<DevicePixels>, Vec<u8>)>
Source§fn layout_line(&self, text: &str, size: Pixels, runs: &[FontRun]) -> LineLayout
fn layout_line(&self, text: &str, size: Pixels, runs: &[FontRun]) -> LineLayout
Source§fn shape_paragraph(
&self,
request: ParagraphRequest<'_>,
) -> Result<Arc<dyn PlatformParagraphShape>>
fn shape_paragraph( &self, request: ParagraphRequest<'_>, ) -> Result<Arc<dyn PlatformParagraphShape>>
Source§fn recommended_rendering_mode(&self, _: FontId, _: Pixels) -> TextRenderingMode
fn recommended_rendering_mode(&self, _: FontId, _: Pixels) -> TextRenderingMode
Source§fn font_axes(
&self,
font_id: FontId,
) -> Result<FontQuery<Vec<VariationAxisInfo>>, Error>
fn font_axes( &self, font_id: FontId, ) -> Result<FontQuery<Vec<VariationAxisInfo>>, Error>
fvar through font_table and parses it in core.Source§fn opentype_features(
&self,
font_id: FontId,
) -> Result<FontQuery<Vec<OpenTypeFeatureInfo>>, Error>
fn opentype_features( &self, font_id: FontId, ) -> Result<FontQuery<Vec<OpenTypeFeatureInfo>>, Error>
font_table and parses them in core.
Invalid IDs, failed reads, and malformed metadata return errors.Source§fn prewarm_fonts(&self, _font_ids: &[FontId])
fn prewarm_fonts(&self, _font_ids: &[FontId])
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 ParleyTextSystem
impl Forget for ParleyTextSystem
impl Move for ParleyTextSystem
impl RefUnwindSafe for ParleyTextSystem
impl Send for ParleyTextSystem
impl Sync for ParleyTextSystem
impl Unpin for ParleyTextSystem
impl UnsafeUnpin for ParleyTextSystem
impl UnwindSafe for ParleyTextSystem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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