Merge pull request #82 from grovesNL/y-offset
Exclude line y offset in height comparison
This commit is contained in:
commit
5fc5d2bbdc
1 changed files with 6 additions and 2 deletions
|
|
@ -207,7 +207,7 @@ impl<'a, 'b> LayoutRunIter<'a, 'b> {
|
||||||
line_i: 0,
|
line_i: 0,
|
||||||
layout_i: 0,
|
layout_i: 0,
|
||||||
remaining_len: bottom_cropped_layout_lines as usize,
|
remaining_len: bottom_cropped_layout_lines as usize,
|
||||||
line_y: buffer.metrics.font_size - buffer.metrics.line_height,
|
line_y: buffer.metrics.y_offset(),
|
||||||
total_layout: 0,
|
total_layout: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +234,7 @@ impl<'a, 'b> Iterator for LayoutRunIter<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.line_y += self.buffer.metrics.line_height;
|
self.line_y += self.buffer.metrics.line_height;
|
||||||
if self.line_y > self.buffer.height {
|
if self.line_y - self.buffer.metrics.y_offset() > self.buffer.height {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,6 +281,10 @@ impl Metrics {
|
||||||
line_height: self.line_height * scale,
|
line_height: self.line_height * scale,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn y_offset(&self) -> i32 {
|
||||||
|
self.font_size - self.line_height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Metrics {
|
impl fmt::Display for Metrics {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue