我在我的页面上使用ACE编辑器,
<script src="ace-builds-master/src-noconflict/ace.js" type="text/javascript" charset="utf-8">
</script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/cobalt");
editor.getSession().setMode("ace/mode/geco");
</script>
默认情况下它显示的是一种字体,我想将我的字体更改为'Tahoma 10pt‘。
我该怎么做?
发布于 2014-02-20 21:49:43
要更改字体,您可以为#editor
添加css规则。或使用
editor.setOptions({
fontFamily: "tahoma",
fontSize: "10pt"
});
但Ace目前只支持等宽字体,而tahoma不是等宽字体,因此光标位置将是错误的。
发布于 2015-08-30 18:55:22
据我所知,除了editor.setOptions()
之外,没有什么捷径可以直接改变Ace的字体家族。
但是,您可以通过调用以下方法直接设置以像素为单位的字体大小:
editor.setFontSize(10) // will set font-size: 10px
https://stackoverflow.com/questions/21900938
复制相似问题