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.

windows: Work around font rendering clipping issue (#14075)

张小白fa9360f78d1f
diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rs
index f3823d9357f..461bae88589 100644
--- a/crates/gpui/src/platform/windows/direct_write.rs
+++ b/crates/gpui/src/platform/windows/direct_write.rs
@@ -583,6 +583,18 @@ impl DirectWriteState {
DWRITE_MEASURING_MODE_NATURAL,
)?
};
+ // todo(windows)
+ // This is a walkaround, deleted when figured out.
+ let y_offset;
+ let extra_height;
+ if params.is_emoji {
+ y_offset = 0;
+ extra_height = 0;
+ } else {
+ // make some room for scaler.
+ y_offset = -1;
+ extra_height = 2;
+ }
if bounds.right < bounds.left {
Ok(Bounds {
@@ -593,11 +605,13 @@ impl DirectWriteState {
Ok(Bounds {
origin: point(
((bounds.left * params.scale_factor).ceil() as i32).into(),
- ((bounds.top * params.scale_factor).ceil() as i32).into(),
+ ((bounds.top * params.scale_factor).ceil() as i32 + y_offset).into(),
),
size: size(
(((bounds.right - bounds.left) * params.scale_factor).ceil() as i32).into(),
- (((bounds.bottom - bounds.top) * params.scale_factor).ceil() as i32).into(),
+ (((bounds.bottom - bounds.top) * params.scale_factor).ceil() as i32
+ + extra_height)
+ .into(),
),
})
}