pub fn layout_ruby(
base_glyphs: &[PositionedGlyph],
ruby_shaped: &[ShapedGlyph],
annotation: &RubyAnnotation,
ruby_px_size: f32,
base_line_height: f32,
) -> RubyLayoutExpand description
Compute ruby layout given pre-shaped base glyphs and ruby glyphs.
§Arguments
base_glyphs— already-shaped and positioned glyphs for the base text. Must not be empty whenannotation.base_rangeis non-empty; the function will return an empty ruby result ifbase_glyphsis empty.ruby_shaped— already-shaped (but not yet positioned) glyphs for the ruby text.x_advancevalues are interpreted as pixel advances scaled byruby_px_size(i.e. the shaper was called withruby_px_sizeas the font size).annotation— the annotation metadata (base byte range + position).ruby_px_size— font size in pixels used to shape the ruby text. Typicallybase_px_size * 0.5.base_line_height— height of the base line in pixels. Used to compute the y offset so that the ruby does not overlap the base glyphs.
§Returns
A RubyLayout containing the base glyphs unchanged and the ruby glyphs
positioned horizontally centred over the base span.