Module fontdue::layout

source ·
Expand description

Tools for laying out strings of text.


  • Miscellaneous metadata associated with a character to assist in layout.
  • A positioned scaled glyph.
  • Configuration for rasterizing a glyph. This struct is also a hashable key that can be used to uniquely identify a rasterized glyph for applications that want to cache glyphs.
  • Text layout requires a small amount of heap usage which is contained in the Layout struct. This context is reused between layout calls. Reusing the Layout struct will greatly reduce memory allocations and is advisable for performance.
  • Settings to configure how text layout is constrained. Text layout is considered best effort and layout may violate the constraints defined here if they prevent text from being laid out.
  • Metrics about a positioned line.
  • A style description for a segment of text.


  • The direction that the Y coordinate increases in. Layout needs to be aware of your coordinate system to place the glyphs correctly.
  • Horizontal alignment options for text when a max_width is provided.
  • Vertical alignment options for text when a max_height is provided.
  • Wrap style is a hint for how strings of text should be wrapped to the next line. Line wrapping can happen when the max width/height is reached.