GlyphRun
struct · ferroui-base · v0.5.0
struct GlyphRun
Represents a sequence of glyphs from a single face of a single font at a single size, and with a single rendering style.
Members
from_glyph_indicesnewglyph_typefacefont_rendering_em_sizeset_font_rendering_em_sizeboundsink_boundsmetricsbaseline_originset_baseline_origincharactersset_charactersglyph_infosset_glyph_infosbidi_levelset_bidi_levelis_left_to_rightbuild_geometrytry_build_geometryget_distance_from_character_hitget_character_hit_from_distanceget_next_caret_character_hitget_previous_caret_character_hitfind_glyph_indexfind_nearest_character_hitdisposeget_intersectionstry_create_immutable_glyph_run_reference
from_glyph_indices
fn from_glyph_indices(glyph_typeface: Rc<GlyphTypeface>, font_rendering_em_size: f64, characters: ReadOnlyMemory<u16>, glyph_indices: &[u16], baseline_origin: Option<Point>, bidi_level: i32) -> Rc<Self>
Creates a glyph run from glyph indices: every glyph is its own cluster and gets the font's horizontal advance.
new
fn new(glyph_typeface: Rc<GlyphTypeface>, font_rendering_em_size: f64, characters: ReadOnlyMemory<u16>, glyph_infos: GlyphInfoList, baseline_origin: Option<Point>, bidi_level: i32) -> Rc<Self>
Creates a glyph run.
glyph_typeface
fn glyph_typeface(self: &Self) -> &Rc<GlyphTypeface>
Gets the glyph typeface for the glyph run.
font_rendering_em_size
fn font_rendering_em_size(self: &Self) -> f64
Gets the em size used for rendering the glyph run.
set_font_rendering_em_size
fn set_font_rendering_em_size(self: &Self, value: f64)
Sets the em size used for rendering the glyph run.
bounds
fn bounds(self: &Self) -> Rect
Gets the conservative bounding box of the glyph run.
ink_bounds
fn ink_bounds(self: &Self) -> Rect
Gets the ink bounds of the glyph run.
metrics
fn metrics(self: &Self) -> GlyphRunMetrics
Gets the metrics of the glyph run.
baseline_origin
fn baseline_origin(self: &Self) -> Point
Gets the baseline origin of the glyph run.
set_baseline_origin
fn set_baseline_origin(self: &Self, value: Point)
Sets the baseline origin of the glyph run.
characters
fn characters(self: &Self) -> ReadOnlyMemory<u16>
Gets the list of UTF-16 code points that represent the Unicode content of the glyph run.
set_characters
fn set_characters(self: &Self, value: ReadOnlyMemory<u16>)
Sets the list of UTF-16 code points that represent the Unicode content of the glyph run.
glyph_infos
fn glyph_infos(self: &Self) -> GlyphInfoList
Gets the list of glyphs to use to render this run.
set_glyph_infos
fn set_glyph_infos(self: &Self, value: GlyphInfoList)
Sets the list of glyphs to use to render this run.
bidi_level
fn bidi_level(self: &Self) -> i32
Gets the bidirectional nesting level of the glyph run.
set_bidi_level
fn set_bidi_level(self: &Self, value: i32)
Sets the bidirectional nesting level of the glyph run.
is_left_to_right
fn is_left_to_right(self: &Self) -> bool
Returns true if the text direction is left-to-right. Otherwise, returns false.
build_geometry
fn build_geometry(self: &Self) -> crate::Ref<crate::media::Geometry>
Obtains geometry for the glyph run.
try_build_geometry
fn try_build_geometry(self: &Self) -> Option<crate::Ref<crate::media::Geometry>>
Obtains a complete monochrome outline suitable for converting text to
editable paths. Returns None if the platform cannot verify completeness
or a glyph requires bitmap or colour rendering. An available empty
outline (for example, a space) is a successful empty geometry.
get_distance_from_character_hit
fn get_distance_from_character_hit(self: &Self, character_hit: CharacterHit) -> f64
Retrieves the offset from the leading edge of the glyph run to the leading or trailing edge of a caret stop containing the specified character hit.
get_character_hit_from_distance
fn get_character_hit_from_distance(self: &Self, distance: f64) -> (CharacterHit, bool)
Retrieves the character hit information that corresponds to the specified distance into the glyph run. The flag tells whether the distance was inside the run.
get_next_caret_character_hit
fn get_next_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
Retrieves the next valid caret character hit in the logical direction in the glyph run.
get_previous_caret_character_hit
fn get_previous_caret_character_hit(self: &Self, character_hit: CharacterHit) -> CharacterHit
Retrieves the previous valid caret character hit in the logical direction in the glyph run.
find_glyph_index
fn find_glyph_index(self: &Self, character_index: i32) -> usize
Finds a glyph index for given character index.
find_nearest_character_hit
fn find_nearest_character_hit(self: &Self, index: i32) -> (CharacterHit, f64)
Finds the nearest character hit at given index. Also returns the width of the found cluster.
dispose
fn dispose(self: &Self)
Releases the platform resources of the run.
get_intersections
fn get_intersections(self: &Self, lower_limit: f32, upper_limit: f32) -> Vec<f32>
Gets the intersections of specified upper and lower limit.
try_create_immutable_glyph_run_reference
fn try_create_immutable_glyph_run_reference(self: &Self) -> Option<Rc<dyn IImmutableGlyphRunReference>>
Creates an immutable reference to the platform resources of this run.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeAnyValueClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherPartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.