Struct directwrite::text_layout::TextLayout
[−]
[src]
pub struct TextLayout { /* fields omitted */ }
The TextLayout interface represents a block of text after it has been fully analyzed and formatted.
Methods
impl TextLayout
[src]
pub unsafe fn from_ptr(ptr: ComPtr<IDWriteTextLayout>) -> Self
[src]
pub unsafe fn get_ptr(&self) -> ComPtr<IDWriteTextLayout>
[src]
pub unsafe fn get_raw(&self) -> *mut IDWriteTextLayout
[src]
pub fn as_format(&self) -> TextFormat
[src]
pub fn determine_min_width(&self) -> f32
[src]
Determines the minimum possible width the layout can be set to without emergency breaking between the characters of whole words occurring.
pub fn get_cluster_metrics_count(&self) -> usize
[src]
Gets the number of ClusterMetrics objects which exist for this TextLayout
pub fn get_cluster_metrics_slice(
&self,
buf: &mut [ClusterMetrics]
) -> Result<usize, usize>
[src]
&self,
buf: &mut [ClusterMetrics]
) -> Result<usize, usize>
Retrieves the ClusterMetrics for the glyph clusters in this layout. You should ensure the
slice is large enough to hold all of the metrics, which can be obtained by calling
get_cluster_metrics_count
. If the slice is not large enough, it will return
Err(actual_count), otherwise returns Ok(actual_count).
pub fn get_cluster_metrics(&self, buf: &mut Vec<ClusterMetrics>)
[src]
Fill all of the Cluster metrics into a Vec. This function will resize the Vec to fit all of the metrics structures exactly.
pub fn get_font_size(
&self,
position: u32
) -> Result<(f32, TextRange), DWriteError>
[src]
&self,
position: u32
) -> Result<(f32, TextRange), DWriteError>
Gets the font em height of the text at the specified position. Also returns the text range which has identical formatting to the current character.
pub fn get_font_stretch(
&self,
position: u32
) -> Result<(FontStretch, TextRange), DWriteError>
[src]
&self,
position: u32
) -> Result<(FontStretch, TextRange), DWriteError>
Gets the font stretch of the text at the specified position. Also returns the text range which has identical formatting to the current character.
pub fn get_font_style(
&self,
position: u32
) -> Result<(FontStyle, TextRange), DWriteError>
[src]
&self,
position: u32
) -> Result<(FontStyle, TextRange), DWriteError>
Gets the font style of the text at the specified position. Also returns the text range which has identical formatting to the current character.
pub fn get_font_weight(
&self,
position: u32
) -> Result<(FontWeight, TextRange), DWriteError>
[src]
&self,
position: u32
) -> Result<(FontWeight, TextRange), DWriteError>
Gets the font weight of the text at the specified position. Also returns the text range which has identical formatting to the current character.
pub fn get_line_metrics_count(&self) -> usize
[src]
Get the number of LineMetrics objects that you need room for when calling
get_line_metrics_slice
pub fn get_line_metrics_slice(
&self,
buf: &mut [LineMetrics]
) -> Result<usize, usize>
[src]
&self,
buf: &mut [LineMetrics]
) -> Result<usize, usize>
Retrieves the information about each individual text line of the text string. You should
first call get_line_metrics_count
to know how large your slice must be to fit all of
the metrics objects. The return value will contain the actual number of elements in the
layout, but the official documentation does not specify whether the array will be filled
with any values in the Err case, so that behavior is not guaranteed between windows
versions.
pub fn get_line_metrics(&self, buf: &mut Vec<LineMetrics>)
[src]
etrieves the information about each individual text line of the text string. Resizes buf
to fit all of the elements exactly.
pub fn get_max_height(&self) -> f32
[src]
Gets the layout maximum height.
pub fn get_max_width(&self) -> f32
[src]
Gets the layout maximum width.
pub fn get_metrics(&self) -> Metrics
[src]
Retrieves overall metrics for the formatted string.
pub fn get_overhang_metrics(&self) -> OverhangMetrics
[src]
Returns the overhangs (in DIPs) of the layout and all objects contained in it, including text glyphs and inline objects.
pub fn hit_test_point(&self, point_x: f32, point_y: f32) -> HitTestPoint
[src]
The application calls this function passing in a specific pixel location relative to the top-left location of the layout box and obtains the information about the correspondent hit-test metrics of the text string where the hit-test has occurred. Returns None if the specified pixel location is outside the string.
pub fn hit_test_text_position(
&self,
position: u32,
trailing: bool
) -> Option<HitTestTextPosition>
[src]
&self,
position: u32,
trailing: bool
) -> Option<HitTestTextPosition>
The application calls this function to get the pixel location relative to the top-left of the layout box given the text position and the logical side of the position. This function is normally used as part of caret positioning of text where the caret is drawn at the location corresponding to the current text editing position. It may also be used as a way to programmatically obtain the geometry of a particular text position in UI automation.
pub fn hit_test_text_range(
&self,
position: u32,
length: u32,
origin_x: f32,
origin_y: f32,
metrics: &mut Vec<HitTestMetrics>
) -> bool
[src]
&self,
position: u32,
length: u32,
origin_x: f32,
origin_y: f32,
metrics: &mut Vec<HitTestMetrics>
) -> bool
The application calls this function to get a set of hit-test metrics corresponding to a range of text positions. One of the main usages is to implement highlight selection of the text string. origin_x and origin_y are added to the hit-test metrics returned.
pub fn set_drawing_effect<E>(&self, effect: &E, range: TextRange) where
E: DrawingEffect,
[src]
E: DrawingEffect,
Sets the drawing style for text within a text range.
pub fn set_font_style(&self, style: FontStyle, range: TextRange)
[src]
Sets the font style for text within a text range.
pub fn set_font_weight(&self, weight: FontWeight, range: TextRange)
[src]
Sets the font weight for text within a text range.
pub fn set_underline(&self, underline: bool, range: TextRange)
[src]
Sets underlining for text within a specified text range.
Trait Implementations
impl FromParams for TextLayout
[src]
type Params = Params
fn from_params(
factory: &mut IDWriteFactory,
params: Params
) -> Result<Self, DWriteError>
[src]
factory: &mut IDWriteFactory,
params: Params
) -> Result<Self, DWriteError>
impl Clone for TextLayout
[src]
fn clone(&self) -> TextLayout
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for TextLayout
[src]
fn eq(&self, __arg_0: &TextLayout) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &TextLayout) -> bool
[src]
This method tests for !=
.