Skip to content

Commit

Permalink
Swap config order of JP and ASCII font
Browse files Browse the repository at this point in the history
Simple way to avoid #26 (trial)
  • Loading branch information
takaxp committed Feb 24, 2023
1 parent 9029cd7 commit 864bee4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ You can use =moom-recommended-keybindings= to set keybindings for each API in a
(moom-recommended-keybindings '(move fit expand fill font reset undo))) ;; 'all
#+end_src

Note: If you don't want rely on using function key to execute a moom command, then add a =wof= option for =moom-recommended-keybindings= as follows:
Note: If you don't want to rely on using function key to execute a moom command, then add a =wof= option for =moom-recommended-keybindings= as follows:

#+begin_src emacs-lisp
(with-eval-after-load "moom"
Expand Down
40 changes: 20 additions & 20 deletions moom-font.el
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
;;; moom-font.el --- A module for resizing Japanese fonts for Moom

;; Copyright (C) 2017-2021 Takaaki ISHIKAWA
;; Copyright (C) 2017-2023 Takaaki ISHIKAWA

;; Author: Takaaki ISHIKAWA <takaxp at ieee dot org>
;; Keywords: frames, faces, convenience
;; Version: 1.4.0
;; Version: 1.4.1
;; Maintainer: Takaaki ISHIKAWA <takaxp at ieee dot org>
;; URL: https://github.com/takaxp/Moom
;; Twitter: @takaxp
Expand Down Expand Up @@ -87,21 +87,21 @@ If `ARG' is nil, the default size is used."
(unless moom-font--pause
(when arg
(setq moom-font--size arg))
(moom-font--update-rescale-alist
(concat ".*" moom-font--ascii ".*") moom-font-ascii-scale)
(moom-font--update-rescale-alist
(concat ".*" moom-font--ja ".*") moom-font-ja-scale)
(set-fontset-font nil 'ascii
(font-spec :family moom-font--ascii
:size moom-font--size))
(moom-font--update-rescale-alist
(concat ".*" moom-font--ascii ".*") moom-font-ascii-scale)
(let ((spec (font-spec :family moom-font--ja
:size moom-font--size)))
(set-fontset-font nil 'japanese-jisx0208 spec)
(set-fontset-font nil 'katakana-jisx0201 spec)
(set-fontset-font nil 'japanese-jisx0212 spec)
(set-fontset-font nil '(#x0080 . #x024F) spec)
(set-fontset-font nil '(#x0370 . #x03FF) spec)
(set-fontset-font nil 'mule-unicode-0100-24ff spec))))
(set-fontset-font nil 'mule-unicode-0100-24ff spec))
(set-fontset-font nil 'ascii
(font-spec :family moom-font--ascii
:size moom-font--size))))

(defun moom-font--extract-font-size (xlfd)
"Try to identify the font size.
Expand Down Expand Up @@ -293,30 +293,30 @@ Optional argument DEC specifies a decreasing step."
(let* ((default-font (face-font 'default nil ?A))
(size
(moom-font--extract-font-size default-font))
(ascii-font
(moom-font--extract-family-name default-font))
(ja-font
(moom-font--extract-family-name (face-font 'default nil ?あ))))
(moom-font--extract-family-name (face-font 'default nil ?あ)))
(ascii-font
(moom-font--extract-family-name default-font)))
(when size
(setq moom-font--size
(setq moom-font--init-size size)))
;; Apply font if found. Otherwise, use the default ASCII or Japanese font.
(if ascii-font
(moom-font-ascii ascii-font)
(cond ((memq window-system '(ns mac))
(moom-font-ascii "Monaco"))
((eq window-system 'w32)
(moom-font-ascii "MS ゴシック"))
((eq window-system 'x)
(moom-font-ascii "TakaoGothic"))))
(if ja-font
(moom-font-ja ja-font)
(cond ((memq window-system '(ns mac))
(moom-font-ja "Osaka"))
((eq window-system 'w32)
(moom-font-ja "MS ゴシック" '(:size 1.0)))
((eq window-system 'x)
(moom-font-ja "TakaoGothic" '(:size 1.0)))))))
(moom-font-ja "TakaoGothic" '(:size 1.0)))))
(if ascii-font
(moom-font-ascii ascii-font)
(cond ((memq window-system '(ns mac))
(moom-font-ascii "Monaco"))
((eq window-system 'w32)
(moom-font-ascii "MS ゴシック"))
((eq window-system 'x)
(moom-font-ascii "TakaoGothic"))))))

(provide 'moom-font)

Expand Down

0 comments on commit 864bee4

Please sign in to comment.