Skip to content

Commit 9dd2582

Browse files
committed
feat: add doom emacs support hidpi setting
1 parent 9e5557d commit 9dd2582

22 files changed

+68
-14
lines changed

content/posts/doom-emacs-set-chinese-font/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Doom Emacs 给中文指定字体"
33
date: 2022-07-13T09:58:09+08:00
44
draft: false
5-
categories: ["工具"]
5+
categories: ["Emacs"]
66
tags: ["emacs", "lisp", "font", "chinese"]
77
---
88

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#+TITLE: Doom Emacs 字体 HiDPI 设置
2+
#+DATE: 2024-07-14
3+
#+DRAFT: false
4+
#+CATEGORYS: Emacs
5+
#+TAGS[]: emacs font doomemacs
6+
7+
我使用的是 =4K= 显示器,其分辨率为 =3840x2160=
8+
9+
在我的 linux 操作环境系统中,我已经将系统层面的整体缩放调整为 =1.5= 倍, 使其整体界面的实际效果以 =2560x1440= 进行显示。用以获得相较于 =1080p= 整数倍缩放获得更宽裕的空间使用,兼顾矢量字体的清晰度。
10+
11+
但是除了在 =emacs -nw= 下运行的时候,例如直接启动 emacs ,我的整体文字仍然按照设定的字体大小,就像固定的像素大小进行渲染和显示。
12+
13+
这在 =4K= 下导致我的文字异常的小,于是在网上寻求解决办法。
14+
15+
幸运的是,我很快的在 =doomemacs= 的 issue 中找到了解决办法。
16+
17+
具体解决办法如下:
18+
19+
#+begin_src elisp
20+
(setq doom-font (font-spec :family "Terminess Nerd Font" :size 16.0 ))
21+
#+end_src
22+
23+
是的,你没有看错,这就是和默认的设置方式一模一样。
24+
25+
但是重点就是 =size= 不是一个整数,而是一个浮点数。
26+
27+
然后我的 emacs 显示效果就完美的应用上了系统设置的 =DPI= 系数

resources/_gen/assets/css/style.scss_26962b449d539ee5c1301a7879e5bb0e.content

+3
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/style.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-1{width:50%}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/2444e9.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-1{height:120px}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/4a7949.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-1{max-height:120px}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/5b98dd.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-2{text-align:center}#id-4{background:#292a2d30}#id-5{background:#292a2d30}#id-6{background:#292a2d30}#id-7{display:flex;justify-content:center}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/726bc0.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-1{width:75%;justify-content:center}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/8aea00.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-1{width:75%;text-align:center}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/a7c26b.min.css","MediaType":"text/css","Data":{}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#id-1{text-align:center}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/d8d1a4.min.css","MediaType":"text/css","Data":{}}

resources/_gen/assets/scss/css/e2eb86.scss_0a26ff472cf8e437a1bd81973ec8ecec.content

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/e2eb86.min.css","MediaType":"text/css","Data":{}}

resources/_gen/assets/scss/css/style.scss_d75fd08668b4bae707167bbce4d8ca46.content

+1-1
Large diffs are not rendered by default.

themes/LoveIt/assets/css/_variables.scss

+20-12
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@
1111

1212
// ========== Global ========== //
1313
// Font and Line Height
14-
$global-font-family: system-ui, -apple-system, Segoe UI, Roboto, Emoji,
15-
Helvetica, Arial, sans-serif !default;
14+
$global-font-family:
15+
system-ui,
16+
-apple-system,
17+
Segoe UI,
18+
Roboto,
19+
Emoji,
20+
Helvetica,
21+
Arial,
22+
sans-serif !default;
1623
$global-font-size: 16px !default;
1724
$global-font-weight: 400 !default;
1825
$global-line-height: 1.5rem !default;
@@ -115,16 +122,17 @@ $pagination-link-hover-color-dark: #fff !default;
115122

116123
// ========== Code ========== //
117124
// Font family and size of the code
118-
$code-font-family: "Source Code Pro", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !default;
119-
$code-font-size: .875rem !default;
125+
$code-font-family: "Source Code Pro", Menlo, Monaco, Consolas, "Liberation Mono",
126+
"Courier New", monospace !default;
127+
$code-font-size: 0.875rem !default;
120128

121129
// Color of the code
122-
$code-color: #E74C3C !default;
123-
$code-color-dark: #E5BF78 !default;
130+
$code-color: #e74c3c !default;
131+
$code-color-dark: #e5bf78 !default;
124132

125133
// Color of the code background
126134
$code-background-color: #f5f5f5 !default;
127-
$code-background-color-dark: #272C34 !default;
135+
$code-background-color-dark: #272c34 !default;
128136

129137
$code-info-color: #9c9c9c !default;
130138
$code-info-color-dark: #b1b0b0 !default;
@@ -183,7 +191,8 @@ $code-type-list:
183191
"language-yml" "YAML",
184192
"language-yaml" "YAML",
185193
"language-wgsl" "WGSL",
186-
!default;
194+
"language-elisp" "ELisp",
195+
"language-lisp" "Lisp" !default;
187196

188197
// Color map of the code highlight
189198
$code-highlight-color-map: (
@@ -259,7 +268,7 @@ $code-highlight-color-map: (
259268
/* GenericStrong */ "gs": #e72d40,
260269
/* GenericSubheading */ "gu": #e72d40,
261270
/* GenericTraceback */ "gt": #e72d40,
262-
/* TextWhitespace */ "w": #bbbbbb,
271+
/* TextWhitespace */ "w": #bbbbbb
263272
) !default;
264273
$code-highlight-color-map-dark: (
265274
/* Parentheses */ "p": #a9a9b3,
@@ -334,7 +343,7 @@ $code-highlight-color-map-dark: (
334343
/* GenericStrong */ "gs": #f16372,
335344
/* GenericSubheading */ "gu": #f16372,
336345
/* GenericTraceback */ "gt": #f16372,
337-
/* TextWhitespace */ "w": #bbbbbb,
346+
/* TextWhitespace */ "w": #bbbbbb
338347
) !default;
339348
// ========== Code ========== //
340349

@@ -352,6 +361,5 @@ $admonition-color-list:
352361
"danger" #ff1744 rgba(68, 138, 255, 0.1),
353362
"bug" #f50057 rgba(255, 23, 68, 0.1),
354363
"example" #651fff rgba(101, 31, 255, 0.1),
355-
"quote" #9e9e9e rgba(159, 159, 159, 0.1),
356-
!default;
364+
"quote" #9e9e9e rgba(159, 159, 159, 0.1) !default;
357365
// ========== Admonition ========== //

0 commit comments

Comments
 (0)