emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enforcing double-width CJK character display


From: Kan-Ru Chen
Subject: Re: enforcing double-width CJK character display
Date: Fri, 11 Nov 2011 16:49:33 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

Werner LEMBERG <address@hidden> writes:

> Essentially yes.  However, the question is what you define as `better'
> -- I'm talking about scalable fonts, of course, not about bitmap
> fonts.  There are two possibilities:
>
>   1. scale the CJK font so that its (CJK) glyphs are exactly the
>      double width of a given mono-width font

I found setting the variable `face-font-rescale-alist' can achieve this,
if you know the scale factor. My current config looks like:

#+begin_src elisp
  ;; Set fallback fonts so I can use this across different system
  (customize-set-variable
   'face-font-family-alternatives
   (cons '("Han" "WenQuanYi Micro Hei" "AR Heiti Light B5" "cwTexYen")
         face-font-family-alternatives))
  ;; Set scale ratio
  (setq face-font-rescale-alist
        '(("WenQuanYi Micro Hei" . 1.2)
          ("cwTexYen" . 1.35)
          ("AR Heiti Light B5" . 1.2)))
  ;; Set default font for han script
  (set-fontset-font t 'han "Han")
  ;; Setting `face-font-rescale-alist' somehow changes the default font
  ;; for new frame.
  (add-to-list 'frame-inherited-parameters 'font)
#+end_src

It would be great if we can automatically set the scale ratio according
to the :avgwidth attribute of the fonts to match the default ascii font,
but I haven't find a good way to manipulate font-object in elisp.

My org-mode tags finally are aligned again.

-- 
Kanru



reply via email to

[Prev in Thread] Current Thread [Next in Thread]