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
andfont::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.
- Glyph
Cache - 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.
- Glyph
Iter - Layout
Iter - 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 (seeVMetrics
) of the face will bey
pixels. Ifx
andy
are equal the scaling is uniform. Non-uniform scaling by a factor f in the horizontal direction is achieved by settingx
equal to f timesy
. - Scaled
Glyph - 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.
- Text
Line Rects - 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. - Font
Collection - The RustType
FontCollection
type used by nannou. - Font
Size - The type used to specify
FontSize
in font points. - Point
- The point type used when working with text.
- Positioned
Glyph - The RustType
PositionedGlyph
type used by nannou. - Scalar
- The type used for scalar values.
- Text
Glyphs - An alias for the iterator yielded by
Text::glyphs
. - Text
Glyphs PerLine - An alias for the iterator yielded by
Text::glyphs_per_line
. - Text
Line Infos - An alias for the line info iterator yielded by
Text::line_infos
. - Text
Lines - An alias for the line iterator yielded by
Text::lines
. - Text
Lines With Rects - An alias for the iterator yielded by
Text::lines_with_rects
.