Trait embedded_graphics_core::text::TextRenderer [−][src]
Text renderer.
The TextRenderer
trait is used to integrate text renderers into embedded-graphics. Users should
not call it directly and instead use the functions provided by the Text
type.
Associated Types
type Color: PixelColor
[src]
Color type.
Required methods
fn draw_string<D>(
&self,
text: &str,
position: Point,
target: &mut D
) -> Result<Point, D::Error> where
D: DrawTarget<Color = Self::Color>,
[src]
&self,
text: &str,
position: Point,
target: &mut D
) -> Result<Point, D::Error> where
D: DrawTarget<Color = Self::Color>,
Draws a string.
The interpretation of the y coordinate of position
is dependent on the implementation and
can, for example, be the top edge of the bounding box or a point on the baseline. The
caller must ensure that the coordinate is first converted with the vertical_offset
method.
The method returns the start position of the next character to allow chaining of multiple draw calls.
Implementation notes
This method must not interpret any control characters and only render a single line of text.
Any control character in the text
should be handled the same way as any other character
that isn't included in the font.
fn draw_whitespace<D>(
&self,
width: u32,
position: Point,
target: &mut D
) -> Result<Point, D::Error> where
D: DrawTarget<Color = Self::Color>,
[src]
&self,
width: u32,
position: Point,
target: &mut D
) -> Result<Point, D::Error> where
D: DrawTarget<Color = Self::Color>,
Draws whitespace of the given width.
The interpretation of the y coordinate of position
is dependent on the implementation and
can, for example, be the top edge of the bounding box or a point on the baseline. The
caller must ensure that the coordinate is first converted with the vertical_offset
method.
The method returns the start position of the next character to allow chaining of multiple draw calls.
fn measure_string(&self, text: &str, position: Point) -> TextMetrics
[src]
Returns the text metrics for a string.
The interpretation of the y coordinate of position
is dependent on the implementation and
can, for example, be the top edge of the bounding box or a point on the baseline. The
caller must ensure that the coordinate is first converted with the vertical_offset
method.
The returned bounding box is zero sized, if the text is completely transparent.
Implementation notes
This method must not interpret any control characters and only render a single line of text.
Any control character in the text
should be handled the same way as any other character
that isn't included in the font.
fn vertical_offset(
&self,
position: Point,
vertical_alignment: VerticalAlignment
) -> Point
[src]
&self,
position: Point,
vertical_alignment: VerticalAlignment
) -> Point
Offsets the point to apply the vertical alignment.
fn line_height(&self) -> u32
[src]
Returns the line height.
The line height is defined as the vertical distance between the baseline of two adjacent lines in pixels.