pub struct TextAttachment {
pub index: u32,
pub width: Points,
pub height: Points,
}Expand description
A view or image inside a text block (see
AttributedText::attachments).
Optional placement is held by AttachmentAlignments, leaving this
struct’s three-field construction compatible with existing engines.
Every engine places it with the same rule: its top
ascent above the baseline, the line reserving its
extent (so a line grows where the attachment reaches
past the font around it). Only the font’s metrics are the platform’s.
Fields§
§index: u32Its placeholder character (UTF-16 offset).
width: PointsWidth.
height: PointsHeight.
Implementations§
Source§impl TextAttachment
impl TextAttachment
Sourcepub fn ascent(&self, font: FontExtent, align: VerticalAlign) -> Points
pub fn ascent(&self, font: FontExtent, align: VerticalAlign) -> Points
The distance of its top above the baseline (negative: below it),
in a line of font: CSS vertical-align for a replaced inline
box. baseline needs no metrics (the height, whatever font is).
Sourcepub fn extent(&self, font: FontExtent, align: VerticalAlign) -> (Points, Points)
pub fn extent(&self, font: FontExtent, align: VerticalAlign) -> (Points, Points)
What its line reserves for it above and below the baseline (each
at least 0): with the font’s own, the line’s extent, so the line
grows where the attachment reaches past the font. Engines give the
placeholder these metrics (a run delegate’s ascent and descent, a
replacement span’s font metrics) and draw its top
ascent above the baseline.