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.

Fix font weight in multiple elements (#49539)

Dinoda7b8f2939be
diff --git a/crates/agent_ui/src/acp/message_editor.rs b/crates/agent_ui/src/acp/message_editor.rs
index 702be48ae4a..47847aef53c 100644
--- a/crates/agent_ui/src/acp/message_editor.rs
+++ b/crates/agent_ui/src/acp/message_editor.rs
@@ -1334,6 +1334,7 @@ impl Render for MessageEditor {
font_fallbacks: settings.buffer_font.fallbacks.clone(),
font_features: settings.buffer_font.features.clone(),
font_size: settings.agent_buffer_font_size(cx).into(),
+ font_weight: settings.buffer_font.weight,
line_height: relative(settings.buffer_line_height.value()),
..Default::default()
};
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 387ab0278b9..0fdffc32f8d 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -28233,7 +28233,7 @@ impl ui_input::ErasedEditor for ErasedEditorImpl {
font_family: settings.ui_font.family.clone(),
font_features: settings.ui_font.features.clone(),
font_size: rems(0.875).into(),
- font_weight: settings.buffer_font.weight,
+ font_weight: settings.ui_font.weight,
font_style: FontStyle::Normal,
line_height: relative(1.2),
color: theme_color.text,
diff --git a/crates/editor/src/hover_popover.rs b/crates/editor/src/hover_popover.rs
index b3039a1545f..f5d5e6d5ab6 100644
--- a/crates/editor/src/hover_popover.rs
+++ b/crates/editor/src/hover_popover.rs
@@ -613,6 +613,7 @@ pub fn hover_markdown_style(window: &Window, cx: &App) -> MarkdownStyle {
let buffer_font_family = settings.buffer_font.family.clone();
let buffer_font_features = settings.buffer_font.features.clone();
let buffer_font_fallbacks = settings.buffer_font.fallbacks.clone();
+ let buffer_font_weight = settings.buffer_font.weight;
let mut base_text_style = window.text_style();
base_text_style.refine(&TextStyleRefinement {
@@ -627,12 +628,14 @@ pub fn hover_markdown_style(window: &Window, cx: &App) -> MarkdownStyle {
code_block: StyleRefinement::default()
.my(rems(1.))
.font_buffer(cx)
- .font_features(buffer_font_features.clone()),
+ .font_features(buffer_font_features.clone())
+ .font_weight(buffer_font_weight),
inline_code: TextStyleRefinement {
background_color: Some(cx.theme().colors().background),
font_family: Some(buffer_font_family),
font_features: Some(buffer_font_features),
font_fallbacks: buffer_font_fallbacks,
+ font_weight: Some(buffer_font_weight),
..Default::default()
},
rule_color: cx.theme().colors().border,
diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs
index c8749143520..1cd19ffb8f7 100644
--- a/crates/markdown/src/markdown.rs
+++ b/crates/markdown/src/markdown.rs
@@ -112,6 +112,7 @@ impl MarkdownStyle {
let theme_settings = ThemeSettings::get_global(cx);
let colors = cx.theme().colors();
+ let buffer_font_weight = theme_settings.buffer_font.weight;
let (buffer_font_size, ui_font_size) = match font {
MarkdownFont::Agent => (
theme_settings.agent_buffer_font_size(cx),
@@ -196,6 +197,7 @@ impl MarkdownStyle {
font_fallbacks: theme_settings.buffer_font.fallbacks.clone(),
font_features: Some(theme_settings.buffer_font.features.clone()),
font_size: Some(buffer_font_size.into()),
+ font_weight: Some(buffer_font_weight),
..Default::default()
},
..Default::default()
@@ -205,6 +207,7 @@ impl MarkdownStyle {
font_fallbacks: theme_settings.buffer_font.fallbacks.clone(),
font_features: Some(theme_settings.buffer_font.features.clone()),
font_size: Some(buffer_font_size.into()),
+ font_weight: Some(buffer_font_weight),
background_color: Some(colors.editor_foreground.opacity(0.08)),
..Default::default()
},
diff --git a/crates/ui/src/components/label/label_like.rs b/crates/ui/src/components/label/label_like.rs
index 03fde4083d5..ba39d7e16f7 100644
--- a/crates/ui/src/components/label/label_like.rs
+++ b/crates/ui/src/components/label/label_like.rs
@@ -189,9 +189,9 @@ impl LabelCommon for LabelLike {
}
fn buffer_font(mut self, cx: &App) -> Self {
- self.base = self
- .base
- .font(theme::ThemeSettings::get_global(cx).buffer_font.clone());
+ let font = theme::ThemeSettings::get_global(cx).buffer_font.clone();
+ self.weight = Some(font.weight);
+ self.base = self.base.font(font);
self
}