Decouple anchor offset from parley alignment

This commit is contained in:
meehl committed 2026-08-26 17:59:01 +02:00
1 parent d217af94c3
commit 1f5e30ae5a
5 files changed
+24 -20

No files matched your search

+5 -2
View File
@@ -355,11 +355,14 @@ unsafe extern "C-unwind" fn draw_string(state: *mut ffi::lua_State) -> c_int {
ctx.recorder.set_draw_color(last_segment.color);
}
// Align layout origin with the physical pixel grid to reduce blurriness
let scale_factor = ctx.window_state.scale_factor();
let layout = ctx.fonts.borrow_mut().layout(job, scale_factor);
// apply offset to account for anchor position
let position = position + layout.anchor_offset(halign);
// align layout anchor with the physical pixel grid to reduce blurriness
let position = (position * scale_factor).round() / scale_factor;
let layout = ctx.fonts.borrow_mut().layout(job, scale_factor);
for glyph in &layout.glyphs {
ctx.recorder.draw_glyph(
LayoutToLogical::new(position.x, position.y).transform_box(&glyph.rect),