Checkpoint

This commit is contained in:
Nathan Sobo
2023-10-05 21:02:26 -06:00
parent e99f6c03c1
commit 65c7765c07
12 changed files with 80 additions and 107 deletions
+6 -14
View File
@@ -1,6 +1,6 @@
use crate::{
black, point, px, Bounds, FontId, Hsla, Layout, Pixels, Point, RunStyle, ShapedBoundary,
ShapedLine, ShapedRun, UnderlineStyle, WindowContext,
black, point, px, Bounds, FontId, Hsla, Pixels, Point, RunStyle, ShapedBoundary, ShapedLine,
ShapedRun, UnderlineStyle, WindowContext,
};
use anyhow::Result;
use smallvec::SmallVec;
@@ -90,15 +90,14 @@ impl Line {
}
}
// todo!
pub fn paint(
&self,
layout: &Layout,
visible_bounds: Bounds<Pixels>,
bounds: Bounds<Pixels>,
visible_bounds: Bounds<Pixels>, // todo!("use clipping")
line_height: Pixels,
cx: &mut WindowContext,
) -> Result<()> {
let origin = layout.bounds.origin;
let origin = bounds.origin;
let padding_top = (line_height - self.layout.ascent - self.layout.descent) / 2.;
let baseline_offset = point(px(0.), padding_top + self.layout.ascent);
@@ -159,17 +158,10 @@ impl Line {
}
if glyph.is_emoji {
cx.paint_emoji(
glyph_origin,
layout.order,
run.font_id,
glyph.id,
self.layout.font_size,
)?;
cx.paint_emoji(glyph_origin, run.font_id, glyph.id, self.layout.font_size)?;
} else {
cx.paint_glyph(
glyph_origin,
layout.order,
run.font_id,
glyph.id,
self.layout.font_size,