Module nannou::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

Modules

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

Structs

  • A context for building some Text.
  • 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.
  • An implementation of a dynamic GPU glyph cache. See the module documentation for more information.
  • 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.
  • 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.
  • 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.
  • A glyph augmented with scaling information. You can query such a glyph for information that depends on the scale of the glyph.
  • An instance of some multi-line text and its layout.
  • An alias for the line rect iterator yielded by Text::line_rects.

Enums

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

Functions

  • Determine the exact height of a block of text.
  • 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.
  • Converts the given font size in “points” to a uniform rusttype::Scale. This is useful for when the font size is not an integer.
  • 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).
  • 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.
  • The position offset required to shift the associated text into the given bounding rectangle.
  • Converts the given font size in “points” to its font size in pixels.
  • Converts the given font size in “points” to a uniform rusttype::Scale.
  • Produce the position of each glyph ready for the rusttype glyph cache.
  • Begin building a Text instance.

Type Aliases

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