Skip to content

Commit 3a46b12

Browse files
committed
feat: setup font
1 parent 7fb13f8 commit 3a46b12

File tree

2 files changed

+69
-47
lines changed

2 files changed

+69
-47
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,26 @@ on:
66

77
jobs:
88
build:
9-
runs-on: ${{ matrix.os }}
10-
strategy:
11-
matrix:
12-
os: [ubuntu-latest]
13-
arch: [amd64, arm64]
9+
runs-on: ubuntu-latest
1410
steps:
15-
- name: Set environment variables
16-
run: |
17-
if [ "${{ matrix.arch }}" = "amd64" ]; then
18-
export ARCH=amd64
19-
elif [ "${{ matrix.arch }}" = "arm64" ]; then
20-
export ARCH=arm64
21-
fi
22-
echo "ARCH=$ARCH" >> $GITHUB_ENV
23-
2411
- name: Checkout
2512
uses: actions/checkout@v3
2613

2714
- name: Set up Docker Buildx
2815
uses: docker/setup-buildx-action@v3
2916

17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@v3
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
3023
- name: Build docker
31-
run: docker build -t emacs-ubuntu-docker-image:latest .
24+
uses: docker/build-push-action@v6
25+
with:
26+
push: false
27+
platforms: linux/amd64,linux/arm64
28+
tags: emacs-ubuntu-docker-image:latest
3229

3330
- name: Save docker
3431
run: docker save emacs-ubuntu-docker-image:latest | gzip > emacs-ubuntu-docker-image-${ARCH}.tar.gz
@@ -37,4 +34,4 @@ jobs:
3734
uses: softprops/action-gh-release@v1
3835
if: startsWith(github.ref, 'refs/tags/')
3936
with:
40-
files: emacs-ubuntu-docker-image-*.*
37+
files: emacs-ubuntu-docker-image.*

README.org

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -735,28 +735,52 @@ ref: https://github.com/manateelazycat/auto-save
735735
** 字体和主题
736736

737737
#+begin_src elisp
738-
(use-package faces
739-
:disabled
740-
:ban minimal?
741-
:custom-face
742-
(variable-pitch
743-
((t (:font ,(font-xlfd-name (font-spec :family "Alegreya"))))))
744-
(default
745-
((t (:font ,(font-xlfd-name (font-spec :family "CaskaydiaCove NFP"))
746-
:height 120))))
747-
(fixed-pitch
748-
((t (:inherit default))))
749-
:config
750-
(set-fontset-font t 'symbol (font-spec :family "Segoe UI Symbol"))
751-
752-
(set-fontset-font t 'emoji (font-spec :family "Segoe UI Emoji"))
753-
754-
(set-fontset-font t 'chinese-gbk (font-spec :family "微软雅黑"))
755-
756-
)
738+
(defun my-font-installed-p (font-name)
739+
"Check if font with FONT-NAME is available."
740+
(find-font (font-spec :name font-name)))
741+
742+
(defun my-setup-fonts ()
743+
"Setup fonts."
744+
(when (display-graphic-p)
745+
;; Set default font
746+
(cl-loop for font in '("CaskaydiaCove NFP" "Fira Code" "Jetbrains Mono"
747+
"SF Mono" "Hack" "Source Code Pro" "Menlo"
748+
"Monaco" "DejaVu Sans Mono" "Consolas")
749+
when (my-font-installed-p font)
750+
return (set-face-attribute 'default nil
751+
:family font
752+
:height 120))
753+
754+
;; Specify font for all unicode characters
755+
(cl-loop for font in '("Segoe UI Emoji" "Apple Symbols" "Symbola" "Symbol")
756+
when (my-font-installed-p font)
757+
return (set-fontset-font t 'symbol (font-spec :family font) nil 'prepend))
758+
759+
;; Emoji
760+
(cl-loop for font in '("Segoe UI Emoji" "Noto Color Emoji" "Apple Color Emoji")
761+
when (my-font-installed-p font)
762+
return (set-fontset-font t
763+
(if (< emacs-major-version 28)'symbol 'emoji)
764+
(font-spec :family font) nil 'prepend))
765+
766+
;; Specify font for Chinese characters
767+
(cl-loop for font in '("微软雅黑" "WenQuanYi Micro Hei Mono")
768+
when (my-font-installed-p font)
769+
return (set-fontset-font t 'han (font-spec :family font)))))
770+
771+
(my-setup-fonts)
772+
(add-hook 'window-setup-hook #'my-setup-fonts)
773+
(add-hook 'server-after-make-frame-hook #'my-setup-fonts)
757774

775+
(ignore-errors
776+
(load-theme 'modus-operandi-tinted :no-confirm))
758777

759-
;;(load-theme 'modus-operandi-tinted :no-confirm)
778+
(use-package nerd-icons
779+
:straight t
780+
:init
781+
(cl-loop for font in '("CaskaydiaCove NFP" "Symbols Nerd Font Mono")
782+
when (my-font-installed-p font)
783+
return (setq nerd-icons-font-family font)))
760784
#+end_src
761785

762786
** ligature 连字体
@@ -2119,19 +2143,20 @@ ref:https://github.com/manateelazycat/toggle-one-window
21192143
(org-use-sub-superscripts '{})
21202144
:config
21212145

2122-
(create-fontset-from-fontset-spec
2123-
(font-xlfd-name
2124-
(font-spec :family "等距更纱黑体 SC"
2125-
:weight 'regular
2126-
:slant 'normal
2127-
:registry "fontset-orgtable")))
2146+
(when (my-font-installed-p "等距更纱黑体 SC")
2147+
(create-fontset-from-fontset-spec
2148+
(font-xlfd-name
2149+
(font-spec :family "等距更纱黑体 SC"
2150+
:weight 'regular
2151+
:slant 'normal
2152+
:registry "fontset-orgtable")))
21282153

2129-
(set-fontset-font "fontset-orgtable" '(#x0 . #xffff)
2130-
(font-spec :family "等距更纱黑体 SC"
2131-
:weight 'regular
2132-
:slant 'normal))
2154+
(set-fontset-font "fontset-orgtable" '(#x0 . #xffff)
2155+
(font-spec :family "等距更纱黑体 SC"
2156+
:weight 'regular
2157+
:slant 'normal))
21332158

2134-
(set-face-attribute 'org-table nil :fontset "fontset-orgtable" :font "fontset-orgtable")
2159+
(set-face-attribute 'org-table nil :fontset "fontset-orgtable" :font "fontset-orgtable"))
21352160

21362161
(defun my--org-prettify-symbols ()
21372162
(setq prettify-symbols-alist

0 commit comments

Comments
 (0)