Font and encoding (in a broad sense, internationalization) are causing problems in many software scenarios, like web browser and editor.
The Unicode U+201C and U+201D are double quotation marks. These two marks are covered by most (if not all) fonts. There are no different code points of double quotation mark for different languages.
What I want to achieve in Emacs is the following. Set the default font to English monospace font (Font A) and use other fonts for characters in certain Unicode range. For example, use Font B for Han characters and Font C for Cyrillic characters.
~/.emacs, I have the following Elisp code.
(set-face-attribute 'default nil :family "Lucida Sans Typewriter" :height 120) (set-fontset-font "fontset-default" '(#x2000 . #x206f) ; doesn't work "Microsoft YaHei" nil 'prepend) (set-fontset-font "fontset-default" 'han ; works "Microsoft YaHei" nil 'prepend) (set-fontset-font "fontset-default" 'cjk-misc ; works "Microsoft YaHei" nil 'prepend) (set-fontset-font "fontset-default" 'cyrillic ; works "Consolas" nil 'prepend)
All calls to
set-fontset-font work fine except the first that tries to use Microsoft YaHei for General Punctuation section in Unicode. I have also tried changing the order of these
set-fontset-font calls, but to no avail.
The reason why it doesn't work, I suspect, is that Emacs only use fallback fonts only if the default font doesn't have the glyphs for the corresponding code points. Since the double quotation marks exist in many languages and thus many fonts have the glyphs for them. Consolas, Lucida Console, Courier, etc. all have the glyphs for them.
Is there any way in Emacs to force to use the specified fonts even if the default font has the glyphs for them?
When coding HTML for Firefox, I have encountered similar situation. I can easily walk around by using the
lang="zh" attribute in the
html tag to tell the browser the document is in Chinese. Is there an Emacs counterpart?
My environment is Emacs 25.1.1 on Windows 7 (en-US).