【问题标题】:Display all unicode characters in Emacs under OS X在 OS X 下显示 Emacs 中的所有 unicode 字符
【发布时间】:2014-03-26 06:14:10
【问题描述】:

首先请看这张截图

我在左侧通过 Homebrew 安装了 GUI Emacs,另一个在 iTerm2 中运行,右侧带有 -nw 选项。他们都使用Droid Sans Mono字体。

但是,如您所见,正确的可以完美处理所有 unicode 字符。我认为 iTerm2 在这里有所帮助:

  • 左边的display 说没有字体可用
  • 右边的display等于terminal code #xF0 #x9F #x8D #xBA

如何在 GUI Emacs 中获得与在 iTerm2 中相同的结果?

【问题讨论】:

    标签: emacs unicode iterm2


    【解决方案1】:

    好的,我终于在我的 emacs 配置中用这些行解决了这个问题:

    ;; set proper language (fixes cyrillic letters in ansi-term)
    (setenv "LANG" "ru_RU.UTF-8")
    
    ;; default font
    (set-face-attribute 'default nil :family "Droid Sans Mono")
    
    ;; font for all unicode characters
    (set-fontset-font t 'unicode "Symbola" nil 'prepend)
    
    ;; override font for cyrillic characters
    (set-fontset-font t 'cyrillic "Droid Sans Mono")
    

    第一行可以忽略,因为它仅用于修复ansi-term中的西里尔字母。

    步骤如下:

    • set-face-attribute设置你的默认字体
    • 然后通过set-fontset-font为特定字符集设置不同的字体

    当然,我需要为 Symbola 字体设置特定的字符范围,但它现在对我有用。

    附:但我仍然无法像在 iTerm2 中那样在 Emacs 中获得彩色表情符号

    【讨论】:

    • 这个问题困扰了我一段时间。我需要“Apple Color Emoji”而不是“Symbola”,但除此之外,您的字体集概念对我来说效果很好。谢谢。
    • 更正 - “Apple Color Emoji”曾经有效。现在 Emacs 故意在 MacOS 上禁用表情符号 - swsnr.de/posts/bye-bye-emojis-emacs-hates-macos
    猜你喜欢
    • 2011-08-28
    • 2012-06-10
    • 1970-01-01
    • 2012-04-02
    • 2011-02-12
    • 2011-06-04
    • 2011-05-16
    • 1970-01-01
    • 2013-01-31
    相关资源
    最近更新 更多