Skip to content

Commit 97c5d8d

Browse files
authored
Upgrade Parley to v0.9.0 (#23916)
This is a pretty small Parley release, but it does include one bug fix for Bevy (+ some dep bumps) Release notes: https://github.com/linebender/parley/releases/tag/v0.9.0 Signed-off-by: Nico Burns <nico@nicoburns.com>
1 parent 2317f7b commit 97c5d8d

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

crates/bevy_text/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ smallvec = { version = "1", default-features = false }
3939
smol_str = { version = "0.2", default-features = false }
4040
sys-locale = "0.3.0"
4141
tracing = { version = "0.1", default-features = false, features = ["std"] }
42-
parley = { version = "0.8.0", default-features = false, features = ["std"] }
42+
parley = { version = "0.9.0", default-features = false, features = ["std"] }
4343
swash = { version = "0.2.6" }
4444

4545
[lints]

crates/bevy_text/src/pipeline.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,12 @@ impl TextPipeline {
388388
layout_info.run_geometry.push(RunGeometry {
389389
section_index,
390390
bounds: Rect::new(
391-
glyph_run.offset(),
392-
line.metrics().min_coord,
393-
glyph_run.offset() + glyph_run.advance(),
394-
line.metrics().max_coord,
391+
line.metrics().inline_min_coord + glyph_run.offset(),
392+
line.metrics().block_min_coord,
393+
line.metrics().inline_min_coord
394+
+ glyph_run.offset()
395+
+ glyph_run.advance(),
396+
line.metrics().block_max_coord,
395397
),
396398
strikethrough_y: glyph_run.baseline() - run.metrics().strikethrough_offset,
397399
strikethrough_thickness: run.metrics().strikethrough_size,
@@ -561,21 +563,14 @@ impl TextMeasureInfo {
561563
// whenever a canonical state is required.
562564
let layout = &mut computed.layout;
563565
layout.break_all_lines(bounds.width);
564-
layout.align(bounds.width, Alignment::Start, AlignmentOptions::default());
566+
layout.align(Alignment::Start, AlignmentOptions::default());
565567
buffer_dimensions(layout)
566568
}
567569
}
568570

569571
fn layout_with_bounds(layout: &mut Layout<TextBrush>, bounds: TextBounds, justify: Justify) {
570572
layout.break_all_lines(bounds.width);
571-
572-
let container_width = if bounds.width.is_none() && justify != Justify::Left {
573-
Some(layout.width())
574-
} else {
575-
bounds.width
576-
};
577-
578-
layout.align(container_width, justify.into(), AlignmentOptions::default());
573+
layout.align(justify.into(), AlignmentOptions::default());
579574
}
580575

581576
/// Calculate the size of the text area for the given buffer.

crates/bevy_ui/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ thiserror = { version = "2", default-features = false }
5151
derive_more = { version = "2", default-features = false, features = ["from"] }
5252
smallvec = { version = "1", default-features = false }
5353
accesskit = "0.24"
54-
parley = { version = "0.8.0", default-features = false, features = ["std"] }
54+
parley = { version = "0.9.0", default-features = false, features = ["std"] }
5555
swash = { version = "0.2.6" }
5656
tracing = { version = "0.1", default-features = false, features = ["std"] }
5757

crates/bevy_ui/src/widget/text_editable.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,15 @@ pub fn update_editable_text_layout(
413413
info.run_geometry.push(RunGeometry {
414414
section_index: brush.section_index as usize,
415415
bounds: Rect {
416-
min: Vec2::new(glyph_run.offset(), line.metrics().min_coord),
416+
min: Vec2::new(
417+
line.metrics().inline_min_coord + glyph_run.offset(),
418+
line.metrics().block_min_coord,
419+
),
417420
max: Vec2::new(
418-
glyph_run.offset() + glyph_run.advance(),
419-
line.metrics().max_coord,
421+
line.metrics().inline_min_coord
422+
+ glyph_run.offset()
423+
+ glyph_run.advance(),
424+
line.metrics().block_max_coord,
420425
),
421426
},
422427
strikethrough_y: glyph_run.baseline()

crates/bevy_ui_widgets/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bevy_window = { path = "../bevy_window", version = "0.19.0-dev" }
2626

2727
# other
2828
accesskit = "0.24"
29-
parley = { version = "0.8.0", default-features = false }
29+
parley = { version = "0.9.0", default-features = false }
3030
smol_str = "0.2"
3131

3232
[features]

0 commit comments

Comments
 (0)