Font: Fontset definiert. Funktionen zum Anpassen der Fontgröße.

This commit is contained in:
2020-12-20 20:05:12 +01:00
parent e240c84188
commit c11924f2a1

View File

@@ -96,6 +96,86 @@
:bind ("<f12>" . 'restart-emacs))
#+END_SRC
* Font
** Font
#+BEGIN_SRC emacs-lisp
;; for unicode
(when (display-graphic-p)
(set-fontset-font "fontset-default" nil
(font-spec :size 20 :name "Symbola")))
;; for emoji
(set-fontset-font
t
'(#x1f300 . #x1fad0)
(cond
((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
((member "Noto Emoji" (font-family-list)) "Noto Emoji")
((member "Segoe UI Emoji" (font-family-list)) "Segoe UI Emoji")
((member "Symbola" (font-family-list)) "Symbola")
((member "Apple Color Emoji" (font-family-list)) "Apple Color Emoji")))
;; font to use
(defconst artr/default-font-family "Source Code Pro")
(defconst artr/default-font-size 100)
(defconst artr/default-icon-size 15)
(set-face-attribute 'default nil
:family artr/default-font-family
:height artr/default-font-size)
#+END_SRC
** Schriftgröße anpassen
#+BEGIN_SRC emacs-lisp
(defun artr/adjust-font-size (height)
"Adjust font size by given height. If height is '0', reset font
size. This function also handles icons and modeline font sizes."
(interactive "nHeight ('0' to reset): ")
(let ((new-height (if (zerop height)
artr/default-font-size
(+ height (face-attribute 'default :height)))))
(set-face-attribute 'default nil :height new-height)
(set-face-attribute 'mode-line nil :height new-height)
(set-face-attribute 'mode-line-inactive nil :height new-height)
(message "Font size: %s" new-height)))
#+END_SRC
** Schrift vergrößern
#+BEGIN_SRC emacs-lisp
(defun artr/increase-font-size ()
"Increase font size by 0.5 (5 in height)."
(interactive)
(artr/adjust-font-size 5))
#+END_SRC
** Schrift verkleinern
#+BEGIN_SRC emacs-lisp
(defun artr/decrease-font-size ()
"Increase font size by 0.5 (5 in height)."
(interactive)
(artr/adjust-font-size -5))
#+END_SRC
** Schriftgröße zurücksetzen
#+BEGIN_SRC emacs-lisp
(defun artr/reset-font-size ()
"Reset font size according to the `artr/default-font-size'."
(interactive)
(artr/adjust-font-size 0))
#+END_SRC
** Keybindings
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C--") 'artr/decrease-font-size)
(global-set-key (kbd "C-*") 'artr/increase-font-size)
(global-set-key (kbd "C-0") 'artr/reset-font-size)
#+END_SRC
* Icons
** Icons
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons)
#+END_SRC
* Magit
Magit ist ein git-Client für Emacs: [[https://magit.vc/manual/magit/#Top][Magit User Manual]]
#+BEGIN_SRC emacs-lisp