skia_safe::textlayout::paragraph

Type Alias Paragraph

Source
pub type Paragraph = RefHandle<skia_textlayout_Paragraph>;

Aliased Type§

struct Paragraph(/* private fields */);

Implementations§

Source§

impl Paragraph

Source

pub fn max_width(&self) -> scalar

Source

pub fn height(&self) -> scalar

Source

pub fn min_intrinsic_width(&self) -> scalar

Source

pub fn max_intrinsic_width(&self) -> scalar

Source

pub fn alphabetic_baseline(&self) -> scalar

Source

pub fn ideographic_baseline(&self) -> scalar

Source

pub fn longest_line(&self) -> scalar

Source

pub fn did_exceed_max_lines(&self) -> bool

Source

pub fn layout(&mut self, width: scalar)

Source

pub fn paint(&self, canvas: &Canvas, p: impl Into<Point>)

Source

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

Source

pub fn get_rects_for_placeholders(&self) -> Vec<TextBox>

Source

pub fn get_glyph_position_at_coordinate( &self, p: impl Into<Point>, ) -> 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

Source

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

Source

pub fn get_line_metrics(&self) -> Vec<LineMetrics<'_>>

Source

pub fn line_number(&self) -> usize

Source

pub fn mark_dirty(&mut self)

Source

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)

Source

pub fn unresolved_codepoints(&mut self) -> Vec<Unichar>

Source

pub fn visit<'a, F>(&mut self, visitor: F)
where F: FnMut(usize, Option<&'a VisitorInfo>),

Source

pub fn extended_visit<'a, F>(&mut self, visitor: F)

Source

pub fn get_path_at(&mut self, line_number: usize) -> (usize, Path)

Returns path for a given line

  • line_number - a line number
  • dest - a resulting path

Returns: a number glyphs that could not be converted to path

Source

pub fn get_path(text_blob: &mut TextBlob) -> Path

Returns path for a text blob

  • text_blob - a text blob

Returns: a path

Source

pub fn contains_emoji(&mut self, text_blob: &mut TextBlob) -> bool

Checks if a given text blob contains glyph with emoji

  • text_blob - a text blob

Returns: true if there is such a glyph

Source

pub fn contains_color_font_or_bitmap( &mut self, text_blob: &mut TextBlob, ) -> 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

Source

pub fn get_line_number_at(&self, code_unit_index: TextIndex) -> 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 given code_unit_index is in, or -1 if the code_unit_index is out of bounds, or when the glyph is truncated or ellipsized away.

Source

pub fn get_line_number_at_utf16_offset( &self, code_unit_index: TextIndex, ) -> 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 given code_unit_index is in, or -1 if the code_unit_index is out of bounds, or when the glyph is truncated or ellipsized away.

Source

pub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>

Returns line metrics info for the line

  • line_number - a line number
  • line_metrics - an address to return the info (in case of null just skipped)

Returns: true if the line is found; false if not

Source

pub fn get_actual_text_range( &self, line_number: usize, include_spaces: bool, ) -> TextRange

Returns the visible text on the line (excluding a possible ellipsis)

  • line_number - a line number
  • include_spaces - indicates if the whitespaces should be included

Returns: the range of the text that is shown in the line

Source

pub fn get_glyph_cluster_at( &self, code_unit_index: TextIndex, ) -> Option<GlyphClusterInfo>

Finds a glyph cluster for text index

  • code_unit_index - a text index
  • glyph_info - a glyph cluster info filled if not null

Returns: true if glyph cluster was found; false if not

Source

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 coordinate
  • dy - y coordinate
  • glyph_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)

Source

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 paragraph
  • glyph_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

Source

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 coordinate
  • glyph_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)

Source

pub fn get_font_at(&self, code_unit_index: TextIndex) -> Font

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

Source

pub fn get_font_at_utf16_offset(&mut self, code_unit_index: usize) -> Font

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

Source

pub fn get_fonts(&self) -> Vec<FontInfo>

Returns the information about all the fonts used to shape the paragraph text

Returns: a list of fonts and text ranges

Trait Implementations§

Source§

impl Debug for Paragraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more