[][src]Struct directwrite::text_layout::TextLayout

#[repr(transparent)]
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 fn create<'a>(factory: &'a Factory) -> TextLayoutBuilder<'a>[src]

Initialize a builder for a new TextLayout.

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 draw(
    &self,
    renderer: &mut TextRenderer,
    origin_x: f32,
    origin_y: f32,
    context: &DrawContext
) -> DWResult<()>
[src]

Draws text using the specified client drawing context.

pub fn cluster_metrics_count(&self) -> usize[src]

Gets the number of ClusterMetrics objects which exist for this TextLayout

pub fn cluster_metrics_slice(
    &self,
    buf: &mut [ClusterMetrics]
) -> Result<usize, usize>
[src]

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 cluster_metrics(&self) -> Vec<ClusterMetrics>[src]

Fill all of the Cluster metrics into a Vec.

pub fn drawing_effect(&self, position: u32) -> RangeResult<Option<ClientEffect>>[src]

Get the drawing effect applied at the specified position

pub fn font_collection(&self, position: u32) -> RangeResult<FontCollection>[src]

Gets the font collection of the text at the specified position. Also returns the text range which has identical formatting to the current character.

pub fn font_family_name(&self, position: u32) -> RangeResult<String>[src]

Get the font family name applied at the specified text position.

pub fn font_size(&self, position: u32) -> RangeResult<f32>[src]

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 font_stretch(
    &self,
    position: u32
) -> RangeResult<UncheckedEnum<FontStretch>>
[src]

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 font_style(&self, position: u32) -> RangeResult<UncheckedEnum<FontStyle>>[src]

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 font_weight(&self, position: u32) -> RangeResult<FontWeight>[src]

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 inline_object(&self, position: u32) -> RangeResult<Option<InlineObject>>[src]

Gets the inline object at the position as-is. May return ptr::null_mut()

pub fn 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 line_metrics_slice(
    &self,
    buf: &mut [LineMetrics]
) -> Result<usize, usize>
[src]

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 line_metrics(&self) -> Vec<LineMetrics>[src]

Retrieves the information about each individual text line of the text string.

pub fn locale_name(&self, position: u32) -> RangeResult<String>[src]

Gets the locale name applied to the text at the specified text position.

pub fn max_height(&self) -> f32[src]

Gets the layout maximum height.

pub fn max_width(&self) -> f32[src]

Gets the layout maximum width.

pub fn metrics(&self) -> TextMetrics[src]

Retrieves overall metrics for the formatted string.

pub fn 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 strikethrough(&self, position: u32) -> RangeResult<bool>[src]

Returns whether the text at the specified position has strikethrough applied.

pub fn underline(&self, position: u32) -> RangeResult<bool>[src]

Returns whether the text at the specified position has underline applied.

pub fn typography(&self, position: u32) -> RangeResult<Typography>[src]

Gets the typography description applied to the text at the specified text position.

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]

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>
) -> DWResult<()>
[src]

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(
    &mut self,
    effect: &impl DrawingEffect,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the drawing style for text within a text range.

pub fn set_font_collection(
    &mut self,
    collection: FontCollection,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the font collection for text within a text range.

pub fn set_font_family_name(
    &mut self,
    name: &str,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the font family used for the specified range of text.

pub fn set_font_size(
    &mut self,
    size: f32,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the font size used for the specified range of text.

pub fn set_font_stretch(
    &mut self,
    stretch: FontStretch,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the font stretch for text within a text range.

pub fn set_font_style(
    &mut self,
    style: FontStyle,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the font style for text within a text range.

pub fn set_font_weight(
    &mut self,
    weight: FontWeight,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the font weight for text within a text range.

pub fn set_inline_object(
    &mut self,
    obj: &InlineObject,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Set the inline object used for a range of text.

pub fn set_locale_name(
    &mut self,
    locale: &str,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Set the locale used for a range of text.

pub fn set_max_height(&mut self, maxh: f32) -> DWResult<()>[src]

Set the max height in DIPs for this text layout.

pub fn set_max_width(&mut self, maxw: f32) -> DWResult<()>[src]

Set the max width in DIPs for this text layout.

pub fn set_strikethrough(
    &mut self,
    strikethrough: bool,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets strikethrough for text within a specified text range.

pub fn set_underline(
    &mut self,
    underline: bool,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets underlining for text within a specified text range.

pub fn set_typography(
    &mut self,
    typography: &Typography,
    range: impl Into<TextRange>
) -> DWResult<()>
[src]

Sets the typography object controlling the font face settings for a range of text.

Methods from Deref<Target = TextFormat>

pub fn flow_direction(&self) -> UncheckedEnum<FlowDirection>[src]

Get the flow direction of text in this format.

pub fn font_collection(&self) -> Option<FontCollection>[src]

Get the font collection this format loaded its font from.

pub fn font_family_name(&self) -> Option<String>[src]

Get the name of the font family specified for this format.

pub fn font_size(&self) -> f32[src]

Get the font size associated with this format.

pub fn font_stretch(&self) -> UncheckedEnum<FontStretch>[src]

Get the stretch applied to this format.

pub fn font_style(&self) -> UncheckedEnum<FontStyle>[src]

Get the style applied to this format.

pub fn font_weight(&self) -> FontWeight[src]

Get the weight applied to this format.

pub fn incremental_tabstop(&self) -> f32[src]

Get the incremental tabstop size for this format.

pub fn line_spacing(&self) -> DWResult<LineSpacing>[src]

Get the line spacing information for this format.

pub fn locale_name(&self) -> DWResult<String>[src]

Get the locale used for this format.

pub fn paragraph_alignment(&self) -> UncheckedEnum<ParagraphAlignment>[src]

Get the paragraph alignment of text under this format.

pub fn reading_direction(&self) -> UncheckedEnum<ReadingDirection>[src]

Get the reading direction of text under this format.

pub fn text_alignment(&self) -> UncheckedEnum<TextAlignment>[src]

Get the alignment of text under this format.

pub fn trimming(&self) -> DWResult<(Trimming, Option<InlineObject>)>[src]

Gets the trimming options for text that overflows the layout box.

The inline object is an omission sign that will be rendered to show that text was omitted.

pub fn word_wrapping(&self) -> UncheckedEnum<WordWrapping>[src]

Get the word wrapping for text under this format.

pub fn set_flow_direction(&mut self, value: FlowDirection) -> DWResult<()>[src]

Set the flow direction for text under this format.

pub fn set_incremental_tabstop(&mut self, value: f32) -> DWResult<()>[src]

Set the incremental tabstop value for text under this format.

pub fn set_line_spacing(
    &mut self,
    method: LineSpacingMethod,
    spacing: f32,
    baseline: f32
) -> DWResult<()>
[src]

Set the line spacing metrics for text under this format.

pub fn set_paragraph_alignment(
    &mut self,
    value: ParagraphAlignment
) -> DWResult<()>
[src]

Set the paragraph alignment for text under this format.

pub fn set_reading_direction(&mut self, value: ReadingDirection) -> DWResult<()>[src]

Set the reading direction used to lay out text under this format.

pub fn set_text_alignment(&mut self, value: TextAlignment) -> DWResult<()>[src]

Set the text alignment for this format.

pub fn set_trimming(
    &self,
    trimming: &Trimming,
    omission_sign: Option<&InlineObject>
) -> DWResult<()>
[src]

Sets trimming options for text overflowing the layout width.

pub fn set_word_wrapping(&mut self, value: WordWrapping) -> DWResult<()>[src]

Set the word wrapping for text under this format.

Trait Implementations

impl Sync for TextLayout[src]

impl Send for TextLayout[src]

impl DerefMut for TextLayout[src]

impl Deref for TextLayout[src]

type Target = TextFormat

The resulting type after dereferencing.

impl Debug for TextLayout[src]

impl ComWrapper for TextLayout[src]

type Interface = IDWriteTextLayout

The raw interface type from winapi

Blanket Implementations

impl<T> FontKey for T where
    T: Send + Sync + 'static + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]