pub struct Tbox {
pub text: SymStr,
pub font: Rc<Font>,
pub locator: Option<Locator>,
pub properties: SymHashMap<Stored>,
pub tokens: Tokens,
}Expand description
Box is a Rust keyword, so we use “Tbox” instead, as in “TeX Box”
Fields§
§text: SymStrplain-text content
font: Rc<Font>associated font for text
locator: Option<Locator>source location where the box originated (None = unknown)
properties: SymHashMap<Stored>misc properties, such as sizing information
tokens: Tokensa Tokens list containing the TeX that created (or could have) the Tbox.
Implementations§
Source§impl Tbox
impl Tbox
Sourcepub fn new(
text: SymStr,
font_opt: Option<Rc<Font>>,
locator_opt: Option<Locator>,
tokens_opt: Tokens,
properties: HashMap<Stored>,
) -> Self
pub fn new( text: SymStr, font_opt: Option<Rc<Font>>, locator_opt: Option<Locator>, tokens_opt: Tokens, properties: HashMap<Stored>, ) -> Self
creates a new Tbox.
If font_opt or locator_opt are None, they are obtained from the
currently active state? Note that text can
be empty, which contributes nothing to the generated document,
but does record the TeX code (in the tokens).
Sourcepub fn is_math(&self) -> bool
pub fn is_math(&self) -> bool
Whether this box is in math mode.
Perl: Box.pm::isMath (L79-81): ($mode || 'restricted_horizontal') =~ /math$/.
Matches “math”, “inline_math”, “display_math”.
Sourcepub fn set_properties<I>(&mut self, entries: I)
pub fn set_properties<I>(&mut self, entries: I)
Batch-insert properties. Equivalent to calling set_property for each
entry, but avoids re-looking up the properties map per call.
Perl: Box.pm::setProperties (L171-175).
Sourcepub fn total_height(&self) -> Dimension
pub fn total_height(&self) -> Dimension
height + depth of this box (the TeX “total height”). Returns Dimension::default() (0pt) when either component is absent. Perl: Box.pm::getTotalHeight (L202-210).
Trait Implementations§
Source§impl BoxOps for Tbox
impl BoxOps for Tbox
Source§fn get_tokens(&self) -> Option<&Tokens>
fn get_tokens(&self) -> Option<&Tokens>
Source§fn get_properties(&self) -> &HashMap<Stored>
fn get_properties(&self) -> &HashMap<Stored>
with_properties instead.Source§fn get_property(&self, key: &str) -> Option<Cow<'_, Stored>>
fn get_property(&self, key: &str) -> Option<Cow<'_, Stored>>
Source§fn with_properties<R, FnR>(&self, caller: FnR) -> R
fn with_properties<R, FnR>(&self, caller: FnR) -> R
Source§fn get_properties_mut(&mut self) -> &mut HashMap<Stored>
fn get_properties_mut(&mut self) -> &mut HashMap<Stored>
Source§fn get_string(&self) -> Result<Cow<'_, str>>
fn get_string(&self) -> Result<Cow<'_, str>>
Source§fn be_absorbed(&self, document: &mut Document) -> Result<Vec<Node>>
fn be_absorbed(&self, document: &mut Document) -> Result<Vec<Node>>
Document XML - returning the corresponding nodesSource§fn compute_size(
&self,
options: HashMap<Stored>,
) -> Result<(Dimension, Dimension, Dimension)>
fn compute_size( &self, options: HashMap<Stored>, ) -> Result<(Dimension, Dimension, Dimension)>
Source§fn unlist(&self) -> Vec<Digested>
fn unlist(&self) -> Vec<Digested>
fn unlist_ref(&self) -> Vec<Cow<'_, Digested>>
Source§fn be_absorbed_mut(&mut self, _document: &mut Document) -> Result<Vec<Node>>
fn be_absorbed_mut(&mut self, _document: &mut Document) -> Result<Vec<Node>>
Alignment only)Source§fn set_property<T: Into<Stored>>(&mut self, key: &str, value: T)
fn set_property<T: Into<Stored>>(&mut self, key: &str, value: T)
Stored types for values)fn get_property_string(&self, key: &str) -> String
Source§fn get_property_mut(&mut self, key: &str) -> Option<&mut Stored>
fn get_property_mut(&mut self, key: &str) -> Option<&mut Stored>
Source§fn has_property(&self, key: &str) -> bool
fn has_property(&self, key: &str) -> bool
Source§fn get_property_bool(&self, key: &str) -> bool
fn get_property_bool(&self, key: &str) -> bool
Stored::Bool)Source§fn get_body(&self) -> Result<Option<Digested>>
fn get_body(&self) -> Result<Option<Digested>>
Source§fn get_width(
&self,
options: Option<HashMap<Stored>>,
) -> Result<Option<RegisterValue>>
fn get_width( &self, options: Option<HashMap<Stored>>, ) -> Result<Option<RegisterValue>>
Source§fn set_height<T: Into<Stored>>(&mut self, width: T)
fn set_height<T: Into<Stored>>(&mut self, width: T)
Source§fn get_height(&self) -> Option<RegisterValue>
fn get_height(&self) -> Option<RegisterValue>
Source§fn get_depth(&self) -> Option<RegisterValue>
fn get_depth(&self) -> Option<RegisterValue>
Source§fn get_size(
&mut self,
options: Option<HashMap<Stored>>,
) -> Result<(Dimension, Dimension, Dimension, Dimension, Dimension, Dimension)>
fn get_size( &mut self, options: Option<HashMap<Stored>>, ) -> Result<(Dimension, Dimension, Dimension, Dimension, Dimension, Dimension)>
Digested::get_size for a variant with interior mutability which caches the box sizeSource§fn compute_size_and_cache(
&mut self,
options: HashMap<Stored>,
) -> Result<(Dimension, Dimension, Dimension)>
fn compute_size_and_cache( &mut self, options: HashMap<Stored>, ) -> Result<(Dimension, Dimension, Dimension)>
pad{top,bottom,left,right} to the computed dimensions. This is the SAFE
part of computeSizeStore — additive and inert until the app layer sets a
pad* property (display math \abovedisplayskip/\belowdisplayskip,
\overline/\underline 2pt, items/equations). The riskier requested-vs-
computed merge + full-spec bypass + isEmpty are deliberately NOT included
here — a mechanical port of those regressed (Rust boxes don’t use
width/height/depth uniformly as “requested box size”); see SYNC_STATUS U2.Source§impl Object for Tbox
impl Object for Tbox
Source§fn get_locator(&self) -> Option<Locator>
fn get_locator(&self) -> Option<Locator>
None is the honest
“no recorded source position” (replacing the old Locator::default()
file!()/line!() sentinel). For “where the parser is now” (error
reporting, box creation), use the free fn gullet::get_locator().