-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode: don't round font sizes #691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From 718be6c4d5661f3558597e4727d47df48354b36b Mon Sep 17 00:00:00 2001 From: musjj <[email protected]> Date: Sat, 21 Dec 2024 19:49:30 +0700 Subject: [PATCH 1/2] vscode: don't round font sizes --- modules/vscode/hm.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/vscode/hm.nix b/modules/vscode/hm.nix index e738b3c7..0e9bdda4 100644 --- a/modules/vscode/hm.nix +++ b/modules/vscode/hm.nix @@ -36,18 +36,18 @@ in { "chat.editor.fontFamily" = monospace.name; # 4/3 factor used for pt to px; - "editor.fontSize" = builtins.floor (sizes.terminal * 4 / 3 + 0.5); - "debug.console.fontSize" = builtins.floor (sizes.terminal * 4 / 3 + 0.5); - "markdown.preview.fontSize" = builtins.floor (sizes.terminal * 4 / 3 + 0.5); - "terminal.integrated.fontSize" = builtins.floor (sizes.terminal * 4 / 3 + 0.5); - "chat.editor.fontSize" = builtins.floor (sizes.terminal * 4 / 3 + 0.5); + "editor.fontSize" = sizes.terminal * 4 / 3; + "debug.console.fontSize" = sizes.terminal * 4 / 3; + "markdown.preview.fontSize" = sizes.terminal * 4 / 3; + "terminal.integrated.fontSize" = sizes.terminal * 4 / 3; + "chat.editor.fontSize" = sizes.terminal * 4 / 3; # other factors (9/14, 13/14, 56/14) based on default for given value # divided by default for `editor.fontSize` (14) from # https://code.visualstudio.com/docs/getstarted/settings#_default-settings. - "editor.minimap.sectionHeaderFontSize" = builtins.floor (sizes.terminal * 4 / 3 * 9 / 14 + 0.5); - "scm.inputFontSize" = builtins.floor (sizes.terminal * 4 / 3 * 13 / 14 + 0.5); - "screencastMode.fontSize" = builtins.floor (sizes.terminal * 4 / 3 * 56 / 14 + 0.5); + "editor.minimap.sectionHeaderFontSize" = sizes.terminal * 4 / 3 * 9 / 14; + "scm.inputFontSize" = sizes.terminal * 4 / 3 * 13 / 14; + "screencastMode.fontSize" = sizes.terminal * 4 / 3 * 56 / 14; }; }; };
LGTM.
From 98733a0eb38f19dddaa32093632553fbd10d1e1d Mon Sep 17 00:00:00 2001 From: musjj <[email protected]> Date: Sat, 21 Dec 2024 20:27:44 +0700 Subject: [PATCH 2/2] vscode: coerce font sizes to floats --- modules/vscode/hm.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/vscode/hm.nix b/modules/vscode/hm.nix index 0e9bdda4..590a4548 100644 --- a/modules/vscode/hm.nix +++ b/modules/vscode/hm.nix @@ -36,18 +36,18 @@ in { "chat.editor.fontFamily" = monospace.name; # 4/3 factor used for pt to px; - "editor.fontSize" = sizes.terminal * 4 / 3; - "debug.console.fontSize" = sizes.terminal * 4 / 3; - "markdown.preview.fontSize" = sizes.terminal * 4 / 3; - "terminal.integrated.fontSize" = sizes.terminal * 4 / 3; - "chat.editor.fontSize" = sizes.terminal * 4 / 3; + "editor.fontSize" = sizes.terminal * 4.0 / 3.0; + "debug.console.fontSize" = sizes.terminal * 4.0 / 3.0; + "markdown.preview.fontSize" = sizes.terminal * 4.0 / 3.0; + "terminal.integrated.fontSize" = sizes.terminal * 4.0 / 3.0; + "chat.editor.fontSize" = sizes.terminal * 4.0 / 3.0; # other factors (9/14, 13/14, 56/14) based on default for given value # divided by default for `editor.fontSize` (14) from # https://code.visualstudio.com/docs/getstarted/settings#_default-settings. - "editor.minimap.sectionHeaderFontSize" = sizes.terminal * 4 / 3 * 9 / 14; - "scm.inputFontSize" = sizes.terminal * 4 / 3 * 13 / 14; - "screencastMode.fontSize" = sizes.terminal * 4 / 3 * 56 / 14; + "editor.minimap.sectionHeaderFontSize" = sizes.terminal * 4.0 / 3.0 * 9.0 / 14.0; + "scm.inputFontSize" = sizes.terminal * 4.0 / 3.0 * 13.0 / 14.0; + "screencastMode.fontSize" = sizes.terminal * 4.0 / 3.0 * 56.0 / 14.0; }; }; };
Why this is necessary?
It's a nix thing: nix-repl> 1 * 4 / 3
1
nix-repl> 1 * 4.0 / 3.0
1.33333 Technically, you only need to have one float, but I felt that it's clearer this way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, you only need to have one float, but I felt that it's clearer this way.
Sounds good.
Link: #691 Reviewed-by: NAHO <[email protected]> (cherry picked from commit 4f489c6)
Successfully created backport PR for |
Link: #691 Reviewed-by: NAHO <[email protected]> (cherry picked from commit 4f489c6)
The font sizes shouldn't be rounded when converting
pt
topx
. For example,13.333
will look bigger than13
and smaller than14
In my configuration, the rounding causes my editor fonts to look really small compared to my standalone terminal.