Round paragraph position until we implement subpixel glyph positioning

This commit is contained in:
Héctor Ramón Jiménez 2023-05-08 16:20:05 +02:00
parent 180cb073bd
commit c6d9221ee4
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 12 additions and 5 deletions

View file

@ -99,6 +99,10 @@ impl Pipeline {
alignment::Vertical::Bottom => bounds.y - total_height,
};
// TODO: Subpixel glyph positioning
let x = x.round() as i32;
let y = y.round() as i32;
let mut swash = cosmic_text::SwashCache::new();
for run in buffer.layout_runs() {
@ -117,9 +121,8 @@ impl Pipeline {
.expect("Create glyph pixel map");
pixels.draw_pixmap(
x as i32 + glyph.x_int + placement.left,
y as i32 - glyph.y_int - placement.top
+ run.line_y as i32,
x + glyph.x_int + placement.left,
y - glyph.y_int - placement.top + run.line_y as i32,
pixmap,
&tiny_skia::PixmapPaint::default(),
tiny_skia::Transform::identity(),

View file

@ -133,10 +133,14 @@ impl Pipeline {
alignment::Vertical::Bottom => y - total_height,
};
// TODO: Subpixel glyph positioning
let left = left.round() as i32;
let top = top.round() as i32;
glyphon::TextArea {
buffer,
left: left as i32,
top: top as i32,
left,
top,
bounds,
default_color: {
let [r, g, b, a] = section.color.into_linear();