tumashu / cnfonts Goto Github PK
View Code? Open in Web Editor NEWemacs中文字体配置工具。可以快速方便的的实现中文字体和英文字体等宽(也就是常说的中英文对齐)。
emacs中文字体配置工具。可以快速方便的的实现中文字体和英文字体等宽(也就是常说的中英文对齐)。
谢谢你的插件!
请问如何根据system-type来设置插件使用对应的profile呢?而不用每次在不同的系统里面需要手动switch-profile
如题在OSX下使用没有作用。奇怪的是通过elpa安装不能自动加载,需要手动加载对应的el文件。
新人种种不懂,就大大帮助解决一下,spacemacs下,您的packgage已经安装,但不知道如何设置cfs。谢谢了
我用的是 spacemacs,每次重新启动 emacs 后,字体都自动变成 12.5, 如何设置启动后的字号为14。
我已经将默认的字号设置为 14 了
dotspacemacs-default-font '("Source Code Pro"
:size 14
:weight normal
:width normal
:powerline-scale 1.1)
// 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 .
This line: https://github.com/tumashu/chinese-fonts-setup/blob/master/chinese-fonts-setup.el#L134
I don't know how to require
the cl
package correctly.
Beside the old Command Lisp package (cl
) has been suggested to be replaced by cl-lib
which has a more cleaner namespace by using cl-
prefix.
你好,我最近在用emacs写论文,想使用仿宋_GB2312。
我在系统上已经安装了,使用命令(cl-prettyprint (font-family-list))也可以看到。
为什么在使用您的工具设置的时候无法使用这个字体?
这个问题是由 emacs XLFD 解析器 bug#17457 引起的,简单来说,就是字体名称中包含“-”时,生成的XLFD不是一个有效的XLFD,无法使用,见 :
http://lists.gnu.org/archive/html/bug-gnu-emacs/2014-05/msg00422.html
XLFD 的相关知识可以参考:
http://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html#Fonts
原来用 xxx 的时候, xxx 会显示为加粗,而使用这个配置之后, xxx 没有任何变化!
你好,我在使用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
变成了(变得对不齐了)
-*-A-OTF Ryumin Pro-normal-normal-normal-*-16-*-*-*-p-0-iso10646-1
即
试过把chinese-gb2312
也加到do-list
那个循环也不行。虽然那个ω
不算是中文,但WenQuanYi好像也有包含了这个字符?为什么调整字体大小的时候它的字体会发生变化呢?请问这个和chinese-fonts-setup
有关吗?
#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键的话,会将已经对齐好的表格打乱,然后必须得通过C-c C-c重新对齐,有点不方便。
我从 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
ui修改字号时两个字号之间的空白处 C-c C-c
提示 当前光标所在位置不对,请将光标移动到 ‘中文字号’ 或者 ‘EXT-B字体字号’ 对应的数字上。
正常需求应该是在该行的任何地方使用 C-c C-c
都可以应用当前行字体设置,这样更合理一点。
安装了extb字体后,就不卡顿了
对于我等有大量文字阅读需要的人来说,最希望就是不同的字号下,行距能随之变化。比方,我可以设置行距为字号的1倍~2倍,那么插件的实用性又能提升一个台阶。
请大大考虑能否实现该功能。
另外,听了代码时间中对于大大的访谈,真心觉得大大很萌很可爱,还是非专业程序员,佩服!
(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)))
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.另外如果用“其他”生成的代码不能实现中英文字体同时缩放,请问还需要添加什么?
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?
在profile中无论如何设置冬青字体的大小都无法让中英文对齐. 雅黑和其他一些字体可以.
我用的是最新版的Spacemacs,Emacs是25.1版本,系统是Archlinux。
用以前版本(v3?)的Chinese-Fonts-Setup(以下简称cfs)的时候,在org-mode下,不同的标题字号是不一样的。中文字体可以和英文字体一样,在不同级别的标题上,显示为不同的字号。
今天更新新版(v4?)的cfs之后,对齐和以前一样没问题,可是org-mode的标题却出问题了。。。
不管是什么级别的标题,中文字体都是和正文一样大小,但是由于英文字体是随着标题的级别不同而改变字号的,所以就显得特别别扭,而且本来就应该随着标题的级别不同而自动改变字号。
我测试了一些其他字体,思源黑体也不行,文泉驿也不行,方正兰亭黑也不行,只有冬青黑体可以。
方便的话,请作者你测试一下,谢谢。
有办法设置为下面这样么?
在编辑org文件的时候使用中英等宽的profile2,在切换到其他buffer编辑python文件的时候不使用中英等宽
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上的字体名称怎么看?
我在网上下载了一个中文字体文件,可是尝试了很多次,也没办法确定到底应该用哪个名字?试过文件名,打开字体文件之后的字体名和标题名。好像跟这个项目关系不大,但是实在是因为这个项目解决我使用org时的中文问题,折腾字体时遇到的问题,十分感谢!
我用的Cygwin。
如果用unicode-font那個包或者什麼都不用,能顯示很多unicode的符號。
用了這個包,中文字體好看很多,但unicode的符號就無法顯示。
弄了很久也沒調整好,不知道什麼情況。
是需要應用的英文字體也包含Unicode符號么?
查看源码里面有
(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)
如题...
我用cfs-edit-profile
设置,发现中文只能唯一选择一种字体,这使得整个org文件标题和正文都是同样的字体。
文档介绍了可以使用(setq cfs-use-face-font-rescale t)
把大小设置成不一样的,请问想把字体设置成不一样的该怎么做呢?
我对emacs lisp不熟,源文件中的方法应该还是通过调大中文字体字号,能否像在终端下那样增大中文字体的间距解决对齐呢,因为增大中文字体字号造成中文字符明显偏大很不协调。
另一种方式是使用中文字符字宽严格为英文字符两倍的字体,可在我的博文中看到效果:http://passchaos.com/2015/03/27/org-mode表格内中文对齐.html
就我理解而言,chinese-fonts-setup通过预先设置好多个字体组合来达到对齐目的。那我如何设置默认的字体组合呢?
设置了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
环境:sapcemacs
今天升级后想体验一下图形化的配置方式,结果出错了,提示如下:
使用图形化工具来调整 profile 文件吗? (y or n) y
cfs-ui-mode: Symbol's function definition is void: custom--initialize-widget-variables
不知应该如何配置 - -,能给个例子吗?
使用快捷键来在UI配置界面的几个选项卡之间进行切换。比如使用l
或者b
切换到上一个选项卡,使用r
或者f
切换到下一个选项卡。
在windows xp系统下,我使用emacs24.3测试了一下chinese-fonts-setup。发现英文字体可以选择其他等宽字体,大小也可以调整。中文大小可以调整,但无论选择什么字体,都只显示宋体,不知道怎么原因。
发现对齐后的字体没有原先默认的好看
但是又找不到原先默认的字体是什么
系统: 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
,改用我自己原来的字体就好使了。
您好。cfs很方便很实用,提个建议,能否不要每次切换profile都保存变量,或者给个选项控制。个人用use-package 来管理所有包,init.el用github同步,每次都会修改init文件很是烦恼。
谢谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.