Type Alias freya_engine::prelude::Paragraph
pub type Paragraph = RefHandle<skia_textlayout_Paragraph>;
Aliased Type§
struct Paragraph(/* private fields */);
Implementations
§impl RefHandle<skia_textlayout_Paragraph>
impl RefHandle<skia_textlayout_Paragraph>
pub fn max_width(&self) -> f32
pub fn height(&self) -> f32
pub fn min_intrinsic_width(&self) -> f32
pub fn max_intrinsic_width(&self) -> f32
pub fn alphabetic_baseline(&self) -> f32
pub fn ideographic_baseline(&self) -> f32
pub fn longest_line(&self) -> f32
pub fn did_exceed_max_lines(&self) -> bool
pub fn layout(&mut self, width: f32)
pub fn paint(&self, canvas: &Canvas, p: impl Into<Point>)
pub fn get_rects_for_range(
&self,
range: Range<usize>,
rect_height_style: RectHeightStyle,
rect_width_style: RectWidthStyle
) -> Vec<TextBox>
pub fn get_rects_for_range( &self, range: Range<usize>, rect_height_style: RectHeightStyle, rect_width_style: RectWidthStyle ) -> Vec<TextBox>
Returns a vector of bounding boxes that enclose all text between start and end glyph indexes, including start and excluding end
pub fn get_rects_for_placeholders(&self) -> Vec<TextBox>
pub fn get_glyph_position_at_coordinate(
&self,
p: impl Into<Point>
) -> skia_textlayout_PositionWithAffinity
pub fn get_glyph_position_at_coordinate( &self, p: impl Into<Point> ) -> skia_textlayout_PositionWithAffinity
Returns the index of the glyph that corresponds to the provided coordinate, with the top left corner as the origin, and +y direction as down
pub fn get_word_boundary(&self, offset: u32) -> Range<usize> ⓘ
pub fn get_word_boundary(&self, offset: u32) -> Range<usize> ⓘ
Finds the first and last glyphs that define a word containing the glyph at index offset
pub fn get_line_metrics(&self) -> Vec<LineMetrics<'_>>
pub fn line_number(&self) -> usize
pub fn mark_dirty(&mut self)
pub fn unresolved_glyphs(&mut self) -> Option<usize>
pub fn unresolved_glyphs(&mut self) -> Option<usize>
This function will return the number of unresolved glyphs or
None
if not applicable (has not been shaped yet - valid case)
pub fn unresolved_codepoints(&mut self) -> Vec<i32>
pub fn visit<'a, F>(&mut self, visitor: F)
pub fn extended_visit<'a, F>(&mut self, visitor: F)
pub fn get_path_at(&mut self, line_number: usize) -> (usize, Handle<SkPath>)
pub fn get_path_at(&mut self, line_number: usize) -> (usize, Handle<SkPath>)
Returns path for a given line
line_number
- a line numberdest
- a resulting path Returns: a number glyphs that could not be converted to path
pub fn get_path(text_blob: &mut RCHandle<SkTextBlob>) -> Handle<SkPath>
pub fn get_path(text_blob: &mut RCHandle<SkTextBlob>) -> Handle<SkPath>
Returns path for a text blob
text_blob
- a text blob Returns: a path
pub fn contains_emoji(&mut self, text_blob: &mut RCHandle<SkTextBlob>) -> bool
pub fn contains_emoji(&mut self, text_blob: &mut RCHandle<SkTextBlob>) -> bool
Checks if a given text blob contains glyph with emoji
text_blob
- a text blob Returns:true
if there is such a glyph
pub fn contains_color_font_or_bitmap(
&mut self,
text_blob: &mut RCHandle<SkTextBlob>
) -> bool
pub fn contains_color_font_or_bitmap( &mut self, text_blob: &mut RCHandle<SkTextBlob> ) -> bool
Checks if a given text blob contains colored font or bitmap
text_blob
- a text blob Returns:true
if there is such a glyph
pub fn get_line_number_at(&self, code_unit_index: usize) -> Option<usize>
pub fn get_line_number_at(&self, code_unit_index: usize) -> Option<usize>
Finds the line number of the line that contains the given UTF-8 index.
index
- a UTF-8 TextIndex into the paragraph Returns: the line number the glyph that corresponds to the givencode_unit_index
is in, or -1 if thecode_unit_index
is out of bounds, or when the glyph is truncated or ellipsized away.
pub fn get_line_number_at_utf16_offset(
&self,
code_unit_index: usize
) -> Option<usize>
pub fn get_line_number_at_utf16_offset( &self, code_unit_index: usize ) -> Option<usize>
Finds the line number of the line that contains the given UTF-16 index.
index
- a UTF-16 offset into the paragraph Returns: the line number the glyph that corresponds to the givencode_unit_index
is in, or -1 if thecode_unit_index
is out of bounds, or when the glyph is truncated or ellipsized away.
pub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>
pub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>
Returns line metrics info for the line
line_number
- a line numberline_metrics
- an address to return the info (in case of null just skipped) Returns:true
if the line is found;false
if not
pub fn get_actual_text_range(
&self,
line_number: usize,
include_spaces: bool
) -> Range<usize> ⓘ
pub fn get_actual_text_range( &self, line_number: usize, include_spaces: bool ) -> Range<usize> ⓘ
Returns the visible text on the line (excluding a possible ellipsis)
line_number
- a line numberinclude_spaces
- indicates if the whitespaces should be included Returns: the range of the text that is shown in the line
pub fn get_glyph_cluster_at(
&self,
code_unit_index: usize
) -> Option<GlyphClusterInfo>
pub fn get_glyph_cluster_at( &self, code_unit_index: usize ) -> Option<GlyphClusterInfo>
Finds a glyph cluster for text index
code_unit_index
- a text indexglyph_info
- a glyph cluster info filled if not null Returns:true
if glyph cluster was found;false
if not
pub fn get_closest_glyph_cluster_at(
&self,
d: impl Into<Point>
) -> Option<GlyphClusterInfo>
pub fn get_closest_glyph_cluster_at( &self, d: impl Into<Point> ) -> Option<GlyphClusterInfo>
Finds the closest glyph cluster for a visual text position
dx
- x coordinatedy
- y coordinateglyph_info
- a glyph cluster info filled if not null Returns:true
if glyph cluster was found;false
if not (which usually means the paragraph is empty)
pub fn get_glyph_info_at_utf16_offset(
&mut self,
code_unit_index: usize
) -> Option<GlyphInfo>
pub fn get_glyph_info_at_utf16_offset( &mut self, code_unit_index: usize ) -> Option<GlyphInfo>
Retrieves the information associated with the glyph located at the given
code_unit_index
.
code_unit_index
- a UTF-16 offset into the paragraphglyph_info
- an optional GlyphInfo struct to hold the information associated with the glyph found at the given index Returns:false
only if the offset is out of bounds
pub fn get_closest_utf16_glyph_info_at(
&mut self,
d: impl Into<Point>
) -> Option<GlyphInfo>
pub fn get_closest_utf16_glyph_info_at( &mut self, d: impl Into<Point> ) -> Option<GlyphInfo>
Finds the information associated with the closest glyph to the given paragraph coordinates.
d
- x/y coordinateglyph_info
- an optional GlyphInfo struct to hold the information associated with the glyph found. The text indices and text ranges are described using UTF-16 offsets Returns:true
if a grapheme cluster was found;false
if not (which usually means the paragraph is empty)
pub fn get_font_at(&self, code_unit_index: usize) -> Handle<SkFont>
pub fn get_font_at(&self, code_unit_index: usize) -> Handle<SkFont>
Returns the font that is used to shape the text at the position
code_unit_index
- text index Returns: font info or an empty font info if the text is not found
pub fn get_font_at_utf16_offset(
&mut self,
code_unit_index: usize
) -> Handle<SkFont>
pub fn get_font_at_utf16_offset( &mut self, code_unit_index: usize ) -> Handle<SkFont>
Returns the font used to shape the text at the given UTF-16 offset.
code_unit_index
- a UTF-16 offset in the paragraph Returns: font info or an empty font info if the text is not found