1

I'm using Emacs and Xubuntu, and my default input is English, but (in Emacs) I use Japanese input method as well. To enter Kanji (Chinese characters), I type some letters (usually from 2 to about half a dozen), and then select from a list of suggested characters displayed in the mini-buffer. My problem is that I don't know how to increase the size of the Japanese characters in the selection-list in the mini-buffer. I have difficulty distinguishing them because they can be quite fiddly. I know how to increase the size of the font in the editing buffer, which I do, but I don't how to increase the size of the characters in the mini-buffer. I've tried scrolling with the cursor in the mini-buffer, but that made the display area bigger than my screen, so the edges were off the screen (and the image was free to move this way and that, until it reached the edge). Find-file: font-size toggle increase

Input selection: font-size toggle no effect

1
  • 1
    So the crux of your question is how to set face/font for echo area / minibuffer? Consider editing the description of your question to make it more concise.
    – shynur
    May 8, 2023 at 12:16

3 Answers 3

1

Perhaps you are using built-in input method kkc. I found that only one line (the last line) of kkc-show-conversion-list-update is the target to change the scale of candidates, but my unskilled solution is pretty long as follows (quoting the entire function to override just to change the last line):

revised the code:

  • Propertize messages by case before outputting it on the last line to prevent from overwriting selector highlights.
  • Setq the scale.
(setq my-kkc-candidate-scale 1.5)

(with-eval-after-load 'kkc
  (defun kkc-show-conversion-list-update ()
    (or kkc-current-conversions-width
        (kkc-setup-current-conversions-width))
    (let* ((current-idx (car kkc-current-conversions))
           (first-slot (aref kkc-current-conversions-width 0))
           (this-idx (aref first-slot 0))
           (next-idx (aref first-slot 1))
           (msg (aref first-slot 2)))
      (if (< current-idx this-idx)
          ;; The currently selected conversion is before the list shown
          ;; previously.  We must start calculation of message width
          ;; from the start again.
          (setq this-idx 1 msg nil)
        (if (>= current-idx next-idx)
            ;; The currently selected conversion is after the list shown
            ;; previously.  We start calculation of message width from
            ;; the conversion next of TO.
            (setq this-idx next-idx msg nil)))
      (if (not msg)
          (let ((len (length kkc-current-conversions))
                (max-width (window-width (minibuffer-window)))
                (width-table kkc-current-conversions-width)
                (width 0)
                (idx this-idx)
                (max-items (length kkc-show-conversion-list-index-chars))
                l)
            ;; Set THIS-IDX to the first index of conversion to be shown
            ;; in MSG, and reflect it in kkc-current-conversions-width.
            (while (<= idx current-idx)
              (if (and (<= (+ width (aref width-table idx)) max-width)
                       (< (- idx this-idx) max-items))
                  (setq width (+ width (aref width-table idx)))
                (setq this-idx idx width (aref width-table idx)))
              (setq idx (1+ idx)
                    l (cdr l)))
            (aset first-slot 0 this-idx)
            ;; Set NEXT-IDX to the next index of the last conversion
            ;; shown in MSG, and reflect it in
            ;; kkc-current-conversions-width.
            (while (and (< idx len)
                        (<= (+ width (aref width-table idx)) max-width)
                        (< (- idx this-idx) max-items))
              (setq width (+ width (aref width-table idx))
                    idx (1+ idx)
                    l (cdr l)))
            (aset first-slot 1 (setq next-idx idx))
            (setq l (nthcdr this-idx kkc-current-conversions))
            (setq msg (format " %c %s"
                              (aref kkc-show-conversion-list-index-chars 0)
                              (propertize (car l)
                                          'kkc-conversion-index this-idx))
                  idx (1+ this-idx)
                  l (cdr l))
            (while (< idx next-idx)
              (setq msg (format "%s  %c %s"
                                msg
                                (aref kkc-show-conversion-list-index-chars
                                      (- idx this-idx))
                                (propertize (car l)
                                            'kkc-conversion-index idx))
                    idx (1+ idx)
                    l (cdr l)))
            (aset first-slot 2 msg)))

      (remove-text-properties 0 (length msg) '(face nil) msg) ;; moved from the highlighting block below
      (put-text-property 0 (length msg) 'face `(:height ,my-kkc-candidate-scale) msg) ;; added

      ;; Highlight the current conversion.
      (if (> current-idx 0)
          (let ((pos 3)
                (limit (length msg)))
            ;; (remove-text-properties 0 (length msg) '(face nil) msg) ;; original.
            (while (not (eq (get-text-property pos 'kkc-conversion-index msg)
                            current-idx))
              (setq pos (next-single-property-change pos 'kkc-conversion-index
                                                     msg limit)))
            (put-text-property pos (next-single-property-change
                                    pos 'kkc-conversion-index msg limit)
                               'face
                               ;; 'highlight ;; original
                               `(:inherit highlight :height ,my-kkc-candidate-scale) ;; modified
                               msg)))
      (let ((message-log-max nil))
        (message "%s" msg)))))
3
  • 1
    Yes, this is exactly what I was hoping for. Although setting the height of the echo area (as you suggested in your alternative idea, above) does allow the candidate kanji to be re-sized, it unfortunately does have some extraneous effects (it re-sizes some, but not all, other messages as they appear in the echo area, which is not as neat---the echo area jumps around a bit). Although it's an acceptable solution, the modification of the kkc-show-conversation-list-update code that you have written here is perfect. I wouldn't say "unskilled." Wow. Thank you very much for your help.
    – Chris
    May 14, 2023 at 1:09
  • glad you like it, and I have revised the code to withstand actual operation.
    – roomworoof
    May 14, 2023 at 3:57
  • 1
    Cool. Thanks for revised code. BTW, I'm just copying your code into my .emacs file---I assume that's what I'm supposed to do.
    – Chris
    May 14, 2023 at 6:30
1

How about toggling manually when you want to use a larger font?

;; global flag for toggle
(setq-default my-scaled nil)

(defun my-scale-minibuf-font ()
  "Increase font size in mini-buffer"
  (setq-local face-remapping-alist '((default :height 1.2)))) ;; set scale as you like

(defun my-toggle-scale-minibuf-font ()
  "Toggle my-scale-minibuf-font"
  (interactive)
  (if my-scaled
      (remove-hook 'minibuffer-setup-hook 'my-scale-minibuf-font)
    (add-hook 'minibuffer-setup-hook 'my-scale-minibuf-font))
  (setq my-scaled (not my-scaled))) ;; invert the flag

;; bind key to toggle
(define-key global-map (kbd "C-c C-t") 'my-toggle-scale-minibuf-font) ;; set key as you like
3
  • Unfortunately, this does not work; it does not increase the font of the list of characters displayed for user-selection (in the mini-buffer). Your suggestion does increase the font in the mini-buffer, Japanese and English, if I type C-x C-f to find a file (which is not where the problem lies), but not when the selection list for Japanese characters is displayed.
    – Chris
    May 9, 2023 at 19:31
  • what name of the input method are you using?
    – roomworoof
    May 10, 2023 at 11:33
  • 1
    I've included two images with my question to demonstrate the effect of your code. Look at the mini-buffer in the second image to see my problem. Also, Input method: japanese (mode line indicator:Aあ) Japanese input method by Roman transliteration and Kana-Kanji conversion. When you use this input method, text entry proceeds in two stages: Roman-Kana transliteration and Kana-Kanji conversion. When you start to enter text, you are in the first stage, Roman-Kana transliteration. Type SPC to proceed to the next stage, Kana-Kanji conversion. Thanks for looking at this.
    – Chris
    May 11, 2023 at 21:54
1

Another idea is just to set the echo area height. This is using an example from EmacsWiki:

(with-eval-after-load 'kkc
  (with-current-buffer (get-buffer " *Echo Area 0*") ; the leading space character is correct
    (setq-local face-remapping-alist '((default (:height 1.5) variable-pitch)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.