summaryrefslogtreecommitdiffstats
path: root/tiny_skia/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-08 16:20:05 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-08 16:20:05 +0200
commitc6d9221ee42b2838ca07b79df710d3d224e1c52a (patch)
treeb8227d519150675175ff8ed73601ac6d2be21c9d /tiny_skia/src
parent180cb073bdb1429e566839b09d6fe86114c83673 (diff)
downloadiced-c6d9221ee42b2838ca07b79df710d3d224e1c52a.tar.gz
iced-c6d9221ee42b2838ca07b79df710d3d224e1c52a.tar.bz2
iced-c6d9221ee42b2838ca07b79df710d3d224e1c52a.zip
Round paragraph position until we implement subpixel glyph positioning
Diffstat (limited to 'tiny_skia/src')
-rw-r--r--tiny_skia/src/text.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs
index ba8a4e4b..a34c7317 100644
--- a/tiny_skia/src/text.rs
+++ b/tiny_skia/src/text.rs
@@ -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(),