GithubHelp home page GithubHelp logo

tumashu / cnfonts Goto Github PK

View Code? Open in Web Editor NEW
692.0 692.0 60.0 3.86 MB

emacs中文字体配置工具。可以快速方便的的实现中文字体和英文字体等宽(也就是常说的中英文对齐)。

Emacs Lisp 100.00%

cnfonts's People

Contributors

bobwxc avatar dewdrops avatar dochang avatar driftcrow avatar jsntn avatar kuangdash avatar poppyer9 avatar tumashu avatar xqliu avatar xuchunyang avatar xwl avatar yatsky avatar yevgnen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cnfonts's Issues

切换中文字体 Emacs 崩溃

使用鼠标切换之间没有使用过的中文字体时,Emacs出现下面对话框,提示崩溃。但是重启Emacs后的中文字体是设置之后的字体,之后切换到这个字体就不会崩溃了。
image

OSX下没有作用

如题在OSX下使用没有作用。奇怪的是通过elpa安装不能自动加载,需要手动加载对应的el文件。

新版 UI 设置界面相关建议

  1. 快捷键支持(以下只是举例说明)
    • h键显示快捷键列表和帮助文档
    • 前三个字体设置选项中,支持快捷键选中光标当前行字体(比如空格键)
    • 第四个等宽对齐选项中,支持快捷键应用当前行字体尺寸设置(比如原来的C-c C-c)
    • 第四个等宽对齐选项中,使用 tab 键切换光标到不同字体的字号处,光标到当前行尾部之后自动换行
    • 第四个等宽对齐选项中,支持光标在字号处使用 - 和 = 来加减字号
    • 设置快捷键在四个选项卡之间切换
    • 使用快捷键 r 来刷新 profile 配置 buffer
  2. 使用 n 和 p 快捷键需要两次才可以切换一行,最好改为一次切换一行
  3. 第四个选项卡中包含调整字体尺寸,却没有在选项卡名称中标注,建议修改个名字
  4. 是否可以在配置文件添加某个设置文件,来默认使用或者不使用ui来配置profile

Unicode 扩充a字体在某些情况下无法正常显示

非常感谢作者的插件。目前遇到一些疑问,当我使用“方正兰亭黑_GBK”字体作为中文主要字体后,当遇到unicode 扩充a字体(中日韩统一表意文字扩展A),不能正常显示。只有使用其他包含有相对应的扩充A字体的字体文件时(如微软雅黑、楷体),才能正常显示扩充A文字,请问如何解决?能否对扩充A文字单独设置一个字体(如HanaMinA.ttf)?

操作环境:Windows10,GNU Emacs 25.0.94.2 (x86_64-w64-mingw32)
screenshot - 2016_9_8 22_21_10

screenshot - 2016_9_8 22_21_34

如何设置启动后的字号为14

我用的是 spacemacs,每次重新启动 emacs 后,字体都自动变成 12.5, 如何设置启动后的字号为14。

我已经将默认的字号设置为 14 了

dotspacemacs-default-font '("Source Code Pro"
                               :size 14
                               :weight normal
                               :width normal
                               :powerline-scale 1.1)

About Apply CFS environment on OSX / CFS 在 osx 上的应用问题

// Environment
OS: osx el capitan 10.11.6 beta
Emacs: Gnu emacs version 24.5.1 release 2015
Type: GUI

// Issue description
Firstable i followed the README file and done all the steps necessary.
After package installed by M-x list-package from site melpa . all methods build in CFS
running as normal. and looks good. so install EXT-b font sets. in this case . i'v installed
HanaMinb as Ext-b english font and simsun as chinese.
After all steps done above. using cfs-edit-profile to change the settings in profile1.
reboot emacs a message "chinese-fonts-setup: load "profile1" successfully." appears below minibuffer.
but actually there is nothing changed.

// Work around
It is strange that after i reboot os x , it works .. everything looks good.
So report this issue for people who use CFS on Os X . I'v no idea what happend . may be some
Font related stuff i guess .

系统已经安装的字体在emacs下不可以

你好,我最近在用emacs写论文,想使用仿宋_GB2312。
我在系统上已经安装了,使用命令(cl-prettyprint (font-family-list))也可以看到。
为什么在使用您的工具设置的时候无法使用这个字体?

使用cfs-*-fontsize调整字体的问题

你好,我在使用cfs-*-fontsize调整字体的时候,请问为什么字体会发生变化?

例如:
我的配置

(set-frame-font
 (font-spec :name "-*-Inconsolata-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1"
            :weight 'normal
            :slant 'normal
            :size 10.0))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font
   (frame-parameter nil 'font)
   charset
   (font-spec :name "-*-WenQuanYi Micro Hei-normal-normal-normal-*-*-*-*-*-p-0-iso10646-1"
              :weight 'normal
              :slant 'normal
              :size 10.0)))

使用cfs-increase-fontsize增加字体大小时,原来使用

-*-WenQuanYi Micro Hei-normal-normal-normal-*-10-*-*-*-p-0-iso10646-1

的字体
screen shot 2016-08-31 at 19 20 12

变成了(变得对不齐了)

-*-A-OTF Ryumin Pro-normal-normal-normal-*-16-*-*-*-p-0-iso10646-1

screen shot 2016-08-31 at 19 20 35

试过把chinese-gb2312也加到do-list那个循环也不行。虽然那个ω不算是中文,但WenQuanYi好像也有包含了这个字符?为什么调整字体大小的时候它的字体会发生变化呢?请问这个和chinese-fonts-setup有关吗?

org-mode粗体斜体无效

#34 里面提到了,我的配置文件是自动生成的,我只修改了字体大小,配置如下

去掉chinese-font-setup后,org-mode中粗体,斜体恢复正常

;;; `cfs--custom-set-fontsnames' 列表有3个子列表,第1个为英文字体列表,第2个为中文字体列表,
;;; 第3个列表中的字体用于显示不常用汉字,每一个字体列表中,*第一个* *有效并可用* 的字体将被使用。
;;; 将光标移动到上述列表中,按 `C-c C-c' 可以测试字体显示效果。另外,用户可以通过命令
;;; `cfs-insert-fontname’ 来选择一个 *可用* 字体,然后在当前光标处插入其字体名称。
(setq cfs--custom-set-fontnames
      '(
        ("Monaco" "Consolas" "DejaVu Sans Mono" "Droid Sans Mono" "PragmataPro" "Courier" "Courier New" "Liberation Mono" "Ubuntu Mono" "Droid Sans Mono Pro" "Inconsolata" "Source Code Pro" "Lucida Console" "Envy Code R" "Andale Mono" "Lucida Sans Typewriter" "monoOne" "Lucida Typewriter" "Panic Sans" "Hack" "Bitstream Vera Sans Mono" "HyperFont" "PT Mono" "Ti92Pluspc" "Excalibur Monospace" "Menlof" "Cousine" "Fira Mono" "Lekton" "M+ 1mn" "BPmono" "Free Mono" "Anonymous Pro" "ProFont" "ProFontWindows" "Latin Modern Mono" "Code 2002" "ProggyCleanTT" "ProggyTinyTT")
        ("微软雅黑" "Microsoft Yahei" "Microsoft_Yahei" "文泉驿等宽微米黑" "文泉驿等宽正黑" "黑体" "Hiragino Sans GB" "文泉驿正黑" "文泉驿点阵正黑" "SimHei" "SimSun" "NSimSun" "FangSong" "KaiTi" "FangSong_GB2312" "KaiTi_GB2312" "LiSu" "YouYuan" "新宋体" "宋体" "楷体_GB2312" "仿宋_GB2312" "幼圆" "隶书" "STXihei" "STKaiti" "STSong" "STZhongsong" "STFangsong" "FZShuTi" "FZYaoti" "STCaiyun" "STHupo" "STLiti" "STXingkai" "STXinwei" "方正姚体" "方正舒体" "方正粗圆_GBK" "华文仿宋" "华文中宋" "华文彩云" "华文新魏" "华文细黑" "华文行楷")
        ("HanaMinB")
       ))

;;; `cfs--custom-set-fontsizes' 中,所有元素的结构都类似:(英文字号 中文字号 EXT-B字体字号)
;;; 将光标移动到各个数字上,按 C-c C-c 查看光标处字号的对齐效果。
;;; 按 C-<up> 增大光标处字号,按 C-<down> 减小光标处字号。
(setq cfs--custom-set-fontsizes
  '(
     (7     7.5   7.5)
     (9     10.5  10.5)
     (10    12.0  12.0)
     (11.5  13.5  13.5)
     (12.5  15.0  15.0)
     (14    16.5  16.5)
     (16    19.5  19.5)
     (18    21.0  21.0)
     (20    24.0  24.0)
     (22    25.5  25.5)
     (24    28.5  28.5)
     (26    31.5  31.5)
     (28    33.0  33.0)
     (30    36.0  36.0)
     (32    39.0  39.0)
     ))

关于TAB对齐的问题

先谢谢你的工作,找了一圈还就是这个好用!
一个疑问是,TAB键的对齐功能似乎失效了,在表格的某个域按TAB键的话,会将已经对齐好的表格打乱,然后必须得通过C-c C-c重新对齐,有点不方便。

Debugger entered--Lisp error: (error "Local variables entry is missing the suffix")

我从 melpa 不能安装 cfs,提示错误 Debugger entered--Lisp error: (error "Local variables entry is missing the suffix")
似乎是melpa上推送出了问题或者推送的版本有点问题,希望可以修改一下。melpa中其他package的安装没有类似问题。

Debugger entered--Lisp error: (error "Local variables entry is missing the suffix")
  signal(error ("Local variables entry is missing the suffix"))
  error("Local variables entry is missing the suffix")
  hack-local-variables()
  autoload-find-file("chinese-fonts-setup.el")
  #[0 "\306\211\211\307\306\310\300!\306\311\300!\306����������:r�\206 

下面是问题截图。
image

image

功能bug:两个字号之间的空白处 C-c C-c 提示为无效命令

ui修改字号时两个字号之间的空白处 C-c C-c 提示 当前光标所在位置不对,请将光标移动到 ‘中文字号’ 或者 ‘EXT-B字体字号’ 对应的数字上。

正常需求应该是在该行的任何地方使用 C-c C-c 都可以应用当前行字体设置,这样更合理一点。

能否设置行距随着字号自动调整的功能

对于我等有大量文字阅读需要的人来说,最希望就是不同的字号下,行距能随之变化。比方,我可以设置行距为字号的1倍~2倍,那么插件的实用性又能提升一个台阶。
请大大考虑能否实现该功能。
另外,听了代码时间中对于大大的访谈,真心觉得大大很萌很可爱,还是非专业程序员,佩服!

Wrong limitation of font size step in cfs--step-fontsize

(defun cfs--step-fontsize (num)
(let* ((profile-name cfs--current-profile-name)
(current-step
(max 1 (min (+ num (cfs--read-fontsize-step profile-name))
(length cfs--fontsizes-fallback)))) 这个貌似改成cfs--custom-set-fontsizes 吗? 否则 step 被限制到最大9了
(fontsizes-list (cfs--get-fontsizes current-step)))
(cfs--set-font fontsizes-list)
(cfs--save-fontsize-step profile-name current-step)
(message cfs--minibuffer-echo-string)))

升级新版之后,中文字体无法显示

从20160601版本升级到20160708版本之后,中文字体无法显示,系统字体正常。使用之前20160601版本的完全正常。如下图所示,使用cfs-edit-profile可以看到中文字体显示的“无”。

Win7 x64,emacs 24.5

test

OSX下C-c C-c预览的时候非常慢

GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2015-04-11 on builder10-9.porkrind.org

请问可能是什么原因?每次按C-c C-c预览都要等几秒出预览窗口,和视频那里秒生效差太远…调起来十分吃力。

关于中英文同时缩放的设置

1.用cfs-edit-profile设置好之后自定义字体,中英文字体可以同时缩放,但是缩放之后并不能保证对齐,说明我之前的误差只是在设置分辨率下肉眼不易察觉,请问这个问题有解么?
2.另外如果用“其他”生成的代码不能实现中英文字体同时缩放,请问还需要添加什么?

README.md: newlines becomes annoying white spaces for Chinese characters

For example, a white space between "方便地" and "实现"

chinese-fonts-setup 是一个emacs中文字体配置工具。可以比较方便地 实现中文字体和英文字体等宽(也就是大家常说的中英文对齐)。

It's a common problem when writing Chinese using markup languages, such as Markdown and org-mode.

I don't have any good solution for this. A simple way is to ignore the limit of line length whenever we need to break Chinese sentence. What do you think?

新版之后,有的中文字体无法随英文字号变化。

我用的是最新版的Spacemacs,Emacs是25.1版本,系统是Archlinux。

用以前版本(v3?)的Chinese-Fonts-Setup(以下简称cfs)的时候,在org-mode下,不同的标题字号是不一样的。中文字体可以和英文字体一样,在不同级别的标题上,显示为不同的字号。

今天更新新版(v4?)的cfs之后,对齐和以前一样没问题,可是org-mode的标题却出问题了。。。
不管是什么级别的标题,中文字体都是和正文一样大小,但是由于英文字体是随着标题的级别不同而改变字号的,所以就显得特别别扭,而且本来就应该随着标题的级别不同而自动改变字号。

我测试了一些其他字体,思源黑体也不行,文泉驿也不行,方正兰亭黑也不行,只有冬青黑体可以。

方便的话,请作者你测试一下,谢谢。

请教个问题

有办法设置为下面这样么?
在编辑org文件的时候使用中英等宽的profile2,在切换到其他buffer编辑python文件的时候不使用中英等宽

cfs--set-font: Invalid font name

C-c C-c 报错:

cfs--set-font: Invalid font name: -*-SimSun-ExtB-normal-normal-normal-*-*-115-*-*-m-0-iso10646-1

e11759b 这个版本没这个问题。

on OS X: 10.10.2。 系统是有这个字体的。

请问windows上的字体名称怎么看

请问windows上的字体名称怎么看?
我在网上下载了一个中文字体文件,可是尝试了很多次,也没办法确定到底应该用哪个名字?试过文件名,打开字体文件之后的字体名和标题名。好像跟这个项目关系不大,但是实在是因为这个项目解决我使用org时的中文问题,折腾字体时遇到的问题,十分感谢!

Unicode處理問題

我用的Cygwin。
如果用unicode-font那個包或者什麼都不用,能顯示很多unicode的符號。
用了這個包,中文字體好看很多,但unicode的符號就無法顯示。

弄了很久也沒調整好,不知道什麼情況。
是需要應用的英文字體也包含Unicode符號么?

调整字体大小后,frame大小也跟着变化

查看源码里面有

(defcustom cfs-keep-frame-size t
  "在调整字体的时候,是否保持当前 frame 大小不变。"
  :group 'chinese-fonts-setup
  :type 'boolean)

但是调整时还是会变化

使用bhj-fonts调整字体大小就不会变化

环境
windows7 64
emacs 25.0.92.1 64

建议支持直接在 配置文件中设置字体

原代码

(defun cfs--read-profile ()
"Get previously saved fonts names and scales from current profile"
(interactive)
(let ((file (cfs--get-current-profile)))
(if (file-readable-p file)
(progn (load-file file)
(list
(if (boundp 'cfs--custom-set-fonts-names)
cfs--custom-set-fonts-names
cfs--fontnames-fallback)
(if (boundp 'cfs--custom-set-fonts-scales)
cfs--custom-set-fonts-scales
cfs--fontscales-fallback)))
(list cfs--fontnames-fallback
cfs--fontscales-fallback))))

建议修改为

(defun cfs--read-profile ()
"Get previously saved fonts names and scales from current profile"
(interactive)
(let ((file (cfs--get-current-profile)))
(if (file-readable-p file) (progn (load-file file)))
(list
(if (boundp 'cfs--custom-set-fonts-names)
cfs--custom-set-fonts-names
cfs--fontnames-fallback)
(if (boundp 'cfs--custom-set-fonts-scales)
cfs--custom-set-fonts-scales
cfs--fontscales-fallback))))

另外,建议将黑体放到后面,黑体太难看了。建议默认将等宽字体 比如:Courier New、新宋体、SimSun-ExtB 作为默认的首选字体,它们的fonts-scales为 '(1.09 1.08 1.14 1.12 1.11 1.2 1.13 1.15 1.14)

w32下无法全屏

大大你好。我很感谢您的插件,让中文在emacs中显示变得几乎完美。但小弟有个疑问,我用了您的插件后,字体大小调到英文16号,但是启动的时间不能全屏。我使用全屏的命令是
(setq initial-frame-alist (quote ((fullscreen . maximized))))
启动后的效果是这样的
screenshot - 2016_5_28 17_26_25
请您一定要帮帮我啊,感谢万分。

org文件的标题和正文可以设置为不同字体吗?

我用cfs-edit-profile设置,发现中文只能唯一选择一种字体,这使得整个org文件标题和正文都是同样的字体。
文档介绍了可以使用(setq cfs-use-face-font-rescale t)把大小设置成不一样的,请问想把字体设置成不一样的该怎么做呢?

设置默认字体

就我理解而言,chinese-fonts-setup通过预先设置好多个字体组合来达到对齐目的。那我如何设置默认的字体组合呢?

Debugger entered--lisp error: (wrong-type-argument integerp nil)

设置了cfs-profiles,使用三种自己设定的模式名字替换掉原本的profile1-3,然后第一次启动emacs
时,提示如下:

Debugger entered--lisp error: (wrong-type-argument integerp nil)
cfs--read-fontsize-step("profile1")
cfs-set-font-with-saved-step()
run-hooks(window-setup-step)
(接下来是一堆乱码)
normal-top-level

windows xp下,只能使用宋体,无法切换中文字体

在windows xp系统下,我使用emacs24.3测试了一下chinese-fonts-setup。发现英文字体可以选择其他等宽字体,大小也可以调整。中文大小可以调整,但无论选择什么字体,都只显示宋体,不知道怎么原因。

Emoji字体不能显示

系统: Ubuntu 16.04, Emacs 24.5.1
用了chinese-fonts-setup后Emoji字体显示是方框,在配置里加
(set-fontset-font t 'symbol (font-spec :family "Symbola") nil 'prepend)

(set-fontset-font t 'symbol (font-spec :family "Symbola") nil 'append)
后重启emacs也无效,但重新eval-buffer后却马上能显示正常的表情字符。
注释掉chinese-fonts-setup,改用我自己原来的字体就好使了。

关于customize-save-variable

您好。cfs很方便很实用,提个建议,能否不要每次切换profile都保存变量,或者给个选项控制。个人用use-package 来管理所有包,init.el用github同步,每次都会修改init文件很是烦恼。
谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.