Merge pull request #131 from nicoburns/fix/non-wrapped-alignment
Fix alignment when using `Wrap::None`
This commit is contained in:
commit
ca48c86f2b
1 changed files with 17 additions and 3 deletions
20
src/shape.rs
20
src/shape.rs
|
|
@ -663,9 +663,23 @@ impl ShapeLine {
|
|||
|
||||
if wrap == Wrap::None {
|
||||
for (span_index, span) in self.spans.iter().enumerate() {
|
||||
current_visual_line
|
||||
.ranges
|
||||
.push((span_index, (0, 0), (span.words.len(), 0)));
|
||||
let mut word_range_width = 0.;
|
||||
let mut number_of_blanks: u32 = 0;
|
||||
for word in span.words.iter() {
|
||||
let word_width = font_size * word.x_advance;
|
||||
word_range_width += word_width;
|
||||
if word.blank {
|
||||
number_of_blanks += 1;
|
||||
}
|
||||
}
|
||||
add_to_visual_line(
|
||||
&mut current_visual_line,
|
||||
span_index,
|
||||
(0, 0),
|
||||
(span.words.len(), 0),
|
||||
word_range_width,
|
||||
number_of_blanks,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
let mut fit_x = line_width;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue