Text paragraphs, styling, fontconfig
This commit is contained in:
@@ -45,10 +45,10 @@ fn layout_element(
|
||||
if let Some(text) = element.text_node() {
|
||||
let content = inset_rect(rect, element.style.padding);
|
||||
if content.size.width > 0.0 && content.size.height > 0.0 {
|
||||
scene.push_text(text_system.prepare(
|
||||
text.text.clone(),
|
||||
scene.push_text(text_system.prepare_spans(
|
||||
text.spans.clone(),
|
||||
content.origin,
|
||||
text.style.with_bounds(content.size),
|
||||
text.style.clone().with_bounds(content.size),
|
||||
));
|
||||
}
|
||||
return;
|
||||
@@ -148,7 +148,12 @@ fn intrinsic_main_size(
|
||||
FlexDirection::Row => (Some(available_main.max(0.0)), Some(cross_size.max(0.0))),
|
||||
FlexDirection::Column => (Some(cross_size.max(0.0)), None),
|
||||
};
|
||||
let content = text_system.measure(&text.text, text.style, constraints.0, constraints.1);
|
||||
let content = text_system.measure_spans(
|
||||
text.spans.clone(),
|
||||
text.style.clone(),
|
||||
constraints.0,
|
||||
constraints.1,
|
||||
);
|
||||
let padding = main_axis_padding(child.style.padding, direction);
|
||||
return main_axis_size(content, direction) + padding;
|
||||
}
|
||||
@@ -169,9 +174,9 @@ fn intrinsic_size(
|
||||
text_system: &mut TextSystem,
|
||||
) -> UiSize {
|
||||
if let Some(text) = element.text_node() {
|
||||
let measured = text_system.measure(
|
||||
&text.text,
|
||||
text.style,
|
||||
let measured = text_system.measure_spans(
|
||||
text.spans.clone(),
|
||||
text.style.clone(),
|
||||
Some(available_size.width.max(0.0)),
|
||||
Some(available_size.height.max(0.0)),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user