2

When I try to make a table that has Korean character (한글) mixed with English words, the table becomes unaligned, and according to an answer about Japanese found here the the same problem with Japanese letters, it seems English letters, and Japanese letters have different base pixel sizes, and thus something needs to be changed at the operating system level.

Table with messed up alignment

Here it is in plain text:

| English word      | Korean word | Memorized? |
|-------------------+-------------+------------|
| friend            | 친구        | yes        |
| to eat            | 먹다        | yes        |
| this row          | is just     | English    |
| to bring with you | 가지고 가다 | no         |

I'm using MacOs Mojave, and actually using spacemacs, any ideas what I can do? Thank you.

17
  • Have you checked the string-width of Korean and Latin characters with your font like suggested in the question you've linked to? Can you add information about your font configuration so people won't have to guess what fonts are you using?
    – user12563
    Commented Mar 26, 2019 at 20:33
  • I'm sorry but what do you mean by checking my string-width? Is that within macOS or within spacemacs?
    – Jim Larsen
    Commented Mar 27, 2019 at 3:21
  • You'll want to call string-width from Emacs with strings with Latin and Korean characters, with the easiest way being the scratch buffer.
    – user12563
    Commented Mar 27, 2019 at 17:05
  • Could you paste the actual text instead of just a screenshot? I'm interested in digging into this, and being able to copy your example into Emacs would help.
    – eeowaa
    Commented Mar 28, 2019 at 2:13
  • @DoMiNeLa10 I'm very sorry, but I don't know how to call something like that. I'm very new to spacemacs, emacs, org-mode... everything. I tried typing :string-width to no avail.
    – Jim Larsen
    Commented Mar 28, 2019 at 3:32

1 Answer 1

1

I'm more than three years late, but it can be fixed using face-font-rescale-alist.

For instance, with JuliaMono 15pt, D2Coding font can be scaled x1.2 to match the width:

(set-frame-font "JuliaMono 15" nil t)
(add-to-list 'default-frame-alist '(font . "JuliaMono 15"))

(defun set-hangul-font (_)
  (set-fontset-font t 'hangul (font-spec :name "D2Coding"))
  (setq face-font-rescale-alist '(("D2Coding" . 1.2))))
(add-to-list 'after-make-frame-functions #'set-hangul-font)

You'll need to fine-tune the size of the Korean font (and/or CJK fonts) of choice with different fonts and sizes.

screenshot

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.