Expand description
Text shaping and glyphs.
Font faces shape with HarfRust and draw their glyphs from skrifa’s
hinted outlines. shaper.rs says where HarfRust’s shaping differs from
the C++ core’s HarfBuzz. Arabic text drawn with glyph PBFs takes
presentation forms instead (arabic.rs).
Glyph requests (glyph_store), the font-face engine
(font_face_engine) and the device’s fonts (system_fonts, with the
system-fonts feature) are the engine’s own.
Re-exports§
pub use glyph::Bounds;pub use glyph::Glyph;pub use glyph::GlyphID;pub use glyph::GlyphIDType;pub use glyph::GlyphMap;pub use glyph::GlyphMetrics;pub use glyph::GlyphPosition;pub use glyph::GlyphPositions;pub use glyph::GlyphRange;pub use glyph::PositionedGlyph;pub use glyph::PositionedLine;pub use glyph::ShapeResults;pub use glyph::Shaping;pub use shaping::PositionedIcon;pub use shaping::ShapingOptions;pub use shaping::anchor_alignment;pub use shaping::anchor_justification;pub use shaping::shape_text;pub use tagged_string::SectionOptions;pub use tagged_string::TaggedString;
Modules§
- atlas
- Where images and glyphs are in an atlas.
- constants
- The layout’s em.
- font_
face_ engine - glyph
- glyph_
pbf - local_
fonts - Text drawn with the fonts on the device rather than the style’s.
- shaping
- Label shaping: breaking a label into lines, placing each line’s glyphs and inline images, and aligning the lines on the label’s anchor.
- system_
fonts - The system’s fonts, for the text that a style’s own fonts leave to them:
- tagged_
string - tiny_
sdf
Structs§
- BiDiRun
- A run of text in one direction, in logical order.
- Glyph
Adjust - Where a shaped glyph goes, in pixels at 24 px: its offset from the pen, and how far it moves the pen.
- Glyph
Cache - Keeps one copy of equal glyphs and glyph ranges. It only holds weak references, so it never keeps a glyph alive. Renderers given the same cache share the glyphs they parse from glyph PBFs, across maps and font stacks. Thread-safe.
- Shaped
Text - Shaped text: its glyphs in visual order, and where each goes.
- Shaper
- A font file that shapes text with HarfRust and draws its glyphs.
Functions§
- shape_
arabic - Shapes text in logical order for glyph PBFs.
- starts_
right_ to_ left - Whether the first character in
textwith a strong direction runs right to left. - visual_
runs - Splits text in logical order into runs of one direction each, and returns the runs in visual order: each paragraph’s runs in visual order, the paragraphs in logical order. Each run keeps its logical order, so a shaper such as HarfBuzz can lay it out in its direction. Text with no runs is one LTR run.