vizia_core::vg::textlayout

Type Alias Paragraph

pub type Paragraph = RefHandle<skia_textlayout_Paragraph>;

Aliased Type§

struct Paragraph(/* private fields */);

Implementations

§

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>

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

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>

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>

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)
where F: FnMut(usize, Option<&'a Handle<skia_textlayout_Paragraph_VisitorInfo>>),

pub fn extended_visit<'a, F>(&mut self, visitor: F)
where F: FnMut(usize, Option<&'a Handle<skia_textlayout_Paragraph_ExtendedVisitorInfo>>),

pub fn get_path_at(&mut self, line_number: usize) -> (usize, Handle<SkPath>)

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

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

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

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>

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.

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 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.

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

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 number
  • include_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>

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

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)

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

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)

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>

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

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

§

impl Debug for RefHandle<skia_textlayout_Paragraph>

§

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

Formats the value using the given formatter. Read more
§

impl<N> Drop for RefHandle<N>
where N: NativeDrop,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<N> PartialEq for RefHandle<N>
where N: NativeDrop + NativePartialEq,

§

fn eq(&self, rhs: &RefHandle<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<N> PointerWrapper<N> for RefHandle<N>
where N: NativeDrop,

§

fn wrap(ptr: *mut N) -> Option<RefHandle<N>>

Wraps a native pointer into a wrapper type. Returns None if the pointer is null.
§

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.
§

fn inner(&self) -> &N

Access the wrapped pointer.
§

fn inner_mut(&mut self) -> &mut N

Access the wrapped pointer.
§

impl<T> RunIterator for RefHandle<T>
where T: NativeDrop + NativeBase<SkShaper_RunIterator>,

§

fn consume(&mut self)

§

fn end_of_current_run(&self) -> usize

§

fn at_end(&self) -> bool