Skip to content

Commit

Permalink
Fix small Text! in a Wrap! not starting a new line
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRodri committed Jan 24, 2025
1 parent 91213a7 commit 144ee70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

* Fix small `Text!` in a `Wrap!` not starting a new line.

# 0.13.8

Expand Down
3 changes: 3 additions & 0 deletions crates/zng-ext-font/src/shaping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2280,6 +2280,7 @@ impl ShapedTextBuilder {
word_ctx_key.direction = info.direction();
if info.kind.is_word() {
let max_width = self.actual_max_width();

fonts.shape_segment(seg, word_ctx_key, features, |shaped_seg, font| {
if self.origin.x + shaped_seg.x_advance > max_width {
// need wrap
Expand All @@ -2300,6 +2301,8 @@ impl ShapedTextBuilder {
};
if !self.out.segments.0[current_start..].is_empty() {
self.push_line_break(true, text);
} else if current_start == 0 && self.allow_first_wrap {
self.out.first_wrapped = true;
}
self.push_glyphs(shaped_seg, self.letter_spacing);
self.push_text_seg(seg, info);
Expand Down

0 comments on commit 144ee70

Please sign in to comment.