Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Respect vertical placement offset for glyphs (#43812)

John Tur450cd3d42ba9
diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rs
index 84539633c9e..22b8e6231aa 100644
--- a/crates/gpui/src/platform/windows/direct_write.rs
+++ b/crates/gpui/src/platform/windows/direct_write.rs
@@ -1515,7 +1515,7 @@ impl IDWriteTextRenderer_Impl for TextRenderer_Impl {
id,
position: point(
px(context.width + glyph_offsets[this_glyph_idx].advanceOffset),
- px(0.0),
+ px(-glyph_offsets[this_glyph_idx].ascenderOffset),
),
index: context.index_converter.utf8_ix,
is_emoji,
diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rs
index 189a3e85c6b..84618eccc43 100644
--- a/crates/gpui/src/text_system/line.rs
+++ b/crates/gpui/src/text_system/line.rs
@@ -369,16 +369,17 @@ fn paint_line(
let content_mask = window.content_mask();
if max_glyph_bounds.intersects(&content_mask.bounds) {
+ let vertical_offset = point(px(0.0), glyph.position.y);
if glyph.is_emoji {
window.paint_emoji(
- glyph_origin + baseline_offset,
+ glyph_origin + baseline_offset + vertical_offset,
run.font_id,
glyph.id,
layout.font_size,
)?;
} else {
window.paint_glyph(
- glyph_origin + baseline_offset,
+ glyph_origin + baseline_offset + vertical_offset,
run.font_id,
glyph.id,
layout.font_size,