且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 ACE 编辑器中更改字体样式?

更新时间:2023-02-04 19:07:04

要更改字体,您可以为 #editor 添加 css 规则.或使用

To change font you can either add a css rule for #editor. or use

editor.setOptions({
  fontFamily: "tahoma",
  fontSize: "10pt"
});

但是 Ace 目前只支持等宽字体,而 tahoma 不是等宽字体,所以光标位置会出错.

But Ace only supports monospace fonts for now, and tahoma isn't monospace, so cursor position will be wrong.