emacs设置字体

* C-h f set-default-font

 set-default-font is an alias for `set-frame-font' in `frame.el'.

(set-default-font FONT &optional KEEP-SIZE FRAMES)

This function is obsolete since 23.1;
use `set-frame-font' instead.

Set the default font to FONT.
When called interactively, prompt for the name of a font, and use
that font on the selected frame.  When called from Lisp, FONT
should be a font name (a string), a font object, font entity, or
font spec.

If KEEP-SIZE is nil, keep the number of frame lines and columns
fixed.  If KEEP-SIZE is non-nil (or with a prefix argument), try
to keep the current frame size fixed (in pixels) by adjusting the
number of lines and columns.

If FRAMES is nil, apply the font to the selected frame only.
If FRAMES is non-nil, it should be a list of frames to act upon,
or t meaning all graphical frames.  Also, if FRAME is non-nil,
alter the user's Customization settings as though the
font-related attributes of the `default' face had been "set in
this session", so that the font is applied to future frames.

* C-h f set-frame-font
set-frame-font is an interactive compiled Lisp function in `frame.el'.

(set-frame-font FONT &optional KEEP-SIZE FRAMES)

Set the default font to FONT.
When called interactively, prompt for the name of a font, and use
that font on the selected frame.  When called from Lisp, FONT
should be a font name (a string), a font object, font entity, or
font spec.

If KEEP-SIZE is nil, keep the number of frame lines and columns
fixed.  If KEEP-SIZE is non-nil (or with a prefix argument), try
to keep the current frame size fixed (in pixels) by adjusting the
number of lines and columns.

If FRAMES is nil, apply the font to the selected frame only.
If FRAMES is non-nil, it should be a list of frames to act upon,
or t meaning all graphical frames.  Also, if FRAME is non-nil,
alter the user's Customization settings as though the
font-related attributes of the `default' face had been "set in
this session", so that the font is applied to future frames.

* 使用的字体
字体的下载位置:

* 查看在emacs中字体的名字
使用 "M-x set-frame-font RET Tab Tab" 可以看到一个字体列表,从而确定字体的名字。
用鼠标点击 列表中的一行,就可以应用这个字体。

* .emacs设置
使用 set-default-font (23.1 以前版本),set-frame-font (23.1开始) 在 ~/.emacs 里添加:
 (set-frame-font "-microsoft-Mac雅黑-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1")

在行末用C-x C-e来运行即可,查看字体的效果


?怎么指定字体的大小
现在能用C-x C = 来增大字体

转载于:https://www.cnblogs.com/vipzrx/p/3455840.html

<think>好的,我现在需要帮用户解决在Emacs中放大字体的问题。首先,我得回忆一下用户之前提供的引用内容,看看有没有相关的信息。用户引用了Emacs 21.x和23.x的版本,但这两个版本可能涉及不同的配置方法。此外,引用[3]提到DejaVu Sans Mono字体,但用户的问题是关于放大字体,可能与字体设置有关,但具体的放大方法可能需要更具体的步骤。 首先,我应该考虑Emacs的不同版本是否有不同的放大方式。例如,较新的版本可能支持更简便的快捷键,而旧版本可能需要修改配置文件。用户可能使用的是较新的版本,所以需要覆盖多种方法。 然后,常见的放大字体方法包括使用快捷键、调整默认字体大小、使用文本缩放模式等。需要检查这些方法是否适用于用户的Emacs版本。例如,C-x C-+ 或 C-x C-- 是常用的缩放快捷键,但可能在终端中不可用,需要图形界面支持。 另外,用户可能需要永久调整字体大小,这涉及到修改.emacs或init.el文件中的配置。比如设置默认字体为DejaVu Sans Mono,并指定字号。这时候需要确保字体名称正确,并且系统已安装该字体。 还要考虑用户可能遇到的问题,比如快捷键不起作用,这时候可能需要检查是否启用了文本缩放模式,或者是否有其他快捷键冲突。此外,如果用户使用终端版的Emacs,可能需要不同的方法,比如调整终端字体大小。 最后,生成相关问题,帮助用户进一步了解相关操作,比如如何缩小字体、恢复默认设置、调整特定模式字体等。</think>在Emacs中调整字体大小有以下三种常用方法: ### 方法1:快捷键缩放(临时调整) 使用组合键$C-x\ C-+$(先按Ctrl+X,再按Ctrl和加号)可逐步放大字体,$C-x\ C--$(Ctrl+X后按Ctrl和减号)缩小字体。该操作基于`text-scale-adjust`函数实现[^1][^2]。 ### 方法2:修改配置文件(永久调整) 在`~/.emacs`或`~/.emacs.d/init.el`中添加: ```lisp (set-face-attribute 'default nil :height 140) ;; 140%基础字号 ``` 或指定具体字体(示例使用引用的DejaVu Sans Mono字体[^3]): ```lisp (set-frame-font "DejaVu Sans Mono-14" nil t) ``` ### 方法3:交互式调整 通过$M-x\ set-frame-font$命令(Alt+X输入命令)实时预览不同字体尺寸。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值