use super::paragraph_layout::paragraph_active_text_style;
use super::*;
impl LayoutEngine {
#[allow(clippy::too_many_arguments)]
pub(super) fn layout_hidden_paragraph_marker(
&self,
tree: &mut PageLayoutContext,
col_node: &mut RenderNode,
para: &Paragraph,
marker_text: &str,
composed: &ComposedParagraph,
styles: &ResolvedStyleSet,
col_area: &LayoutRect,
flow_y: f64,
section_index: usize,
para_index: usize,
) {
let (style, char_shape_id) = paragraph_active_text_style(styles, Some(para), 0);
let height = style.font_size;
let baseline = height * 0.85;
let para_style = styles.para_styles.get(composed.para_style_id as usize);
let left = para_style.map_or(0.0, |s| {
crate::renderer::equation_tac_flow::paragraph_effective_margin_left(
s.margin_left,
s.indent,
0,
)
});
let right = para_style.map_or(0.0, |s| s.margin_right);
let width = col_area.width - left - right;
let x = col_area.x
+ left
+ match para_style.map(|s| s.alignment) {
Some(Alignment::Center | Alignment::Distribute) => width / 2.0,
Some(Alignment::Right) => width,
_ => 0.0,
};
let mut line = RenderNode::new(
tree.next_id(),
RenderNodeType::TextLine(TextLineNode::with_para(
height,
baseline,
section_index,
para_index,
)),
BoundingBox::new(x, flow_y, 0.0, height),
)
.with_editor_only();
line.children.push(RenderNode::new(
tree.next_id(),
RenderNodeType::TextRun(TextRunNode {
text: marker_text.to_owned(),
style,
char_shape_id,
para_shape_id: Some(composed.para_style_id),
section_index: Some(section_index),
para_index: Some(para_index),
char_start: Some(0),
cell_context: None,
is_para_end: true,
is_line_break_end: false,
rotation: 0.0,
is_vertical: false,
char_overlap: None,
border_fill_id: 0,
baseline,
field_marker: FieldMarkerType::None,
layout_positions: None,
display_text: None,
}),
BoundingBox::new(x, flow_y, 0.0, height),
));
col_node.children.push(line);
}
}