Module text

Source
Expand description

Text layout logic.

Currently, this crate is used primarily by the draw.text() API but will also play an important role in future GUI work.

Re-exports§

pub use self::layout::Layout;

Modules§

cursor
Logic related to the positioning of the cursor within text.
font
The font::Id and font::Map types.
glyph
Logic and types specific to individual glyph layout.
layout
Items related to the styling of text.
line
Text handling logic related to individual lines of text.
rt
Re-exported RustType geometric types.

Structs§

Builder
A context for building some Text.
Glyph
A single glyph of a font. this may either be a thin wrapper referring to the font and the glyph id, or it may be a standalone glyph that owns the data needed by it.
GlyphCache
An implementation of a dynamic GPU glyph cache. See the module documentation for more information.
GlyphId
Represents a glyph identifier for a particular font. This identifier will not necessarily correspond to the correct glyph in a font other than the one that it was obtained from.
GlyphIter
LayoutIter
Lines
An iterator yielding each line within the given text as a new &str, where the start and end indices into each line are provided by the given iterator.
Scale
Defines the size of a rendered face of a font, in pixels, horizontally and vertically. A vertical scale of y pixels means that the distance betwen the ascent and descent lines (see VMetrics) of the face will be y pixels. If x and y are equal the scaling is uniform. Non-uniform scaling by a factor f in the horizontal direction is achieved by setting x equal to f times y.
ScaledGlyph
A glyph augmented with scaling information. You can query such a glyph for information that depends on the scale of the glyph.
Text
An instance of some multi-line text and its layout.
TextLineRects
An alias for the line rect iterator yielded by Text::line_rects.

Enums§

Align
Alignment along an axis.
Justify
A type used for referring to typographic alignment of Text.
Wrap
The way in which text should wrap around the width.

Functions§

exact_height
Determine the exact height of a block of text.
f32_pt_to_px
Converts the given font size in “points” to its font size in pixels. This is useful for when the font size is not an integer.
f32_pt_to_scale
Converts the given font size in “points” to a uniform rusttype::Scale. This is useful for when the font size is not an integer.
height_by_lines
Determine the total height of a block of text with the given number of lines, font size and line_spacing (the space that separates each line of text).
lines
Produce an iterator yielding each line within the given text as a new &str, where the start and end indices into each line are provided by the given iterator.
position_offset
The position offset required to shift the associated text into the given bounding rectangle.
pt_to_px
Converts the given font size in “points” to its font size in pixels.
pt_to_scale
Converts the given font size in “points” to a uniform rusttype::Scale.
rt_positioned_glyphs
Produce the position of each glyph ready for the rusttype glyph cache.
text
Begin building a Text instance.

Type Aliases§

Font
The RustType Font type used by nannou.
FontCollection
The RustType FontCollection type used by nannou.
FontSize
The type used to specify FontSize in font points.
Point
The point type used when working with text.
PositionedGlyph
The RustType PositionedGlyph type used by nannou.
Scalar
The type used for scalar values.
TextGlyphs
An alias for the iterator yielded by Text::glyphs.
TextGlyphsPerLine
An alias for the iterator yielded by Text::glyphs_per_line.
TextLineInfos
An alias for the line info iterator yielded by Text::line_infos.
TextLines
An alias for the line iterator yielded by Text::lines.
TextLinesWithRects
An alias for the iterator yielded by Text::lines_with_rects.