How do I change the Font Style in ACE editor?

I am using ACE editor on my page,

<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>

By default it is showing a font, I want to change my font to 'Tahoma 10pt'.

How do I do that?

Answers


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

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

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


To my knowledge there is no shortcut to directly change Ace's font family other than editor.setOptions().

However you can set the font size in pixels directly by calling:

editor.setFontSize(10) // will set font-size: 10px

Need Your Help

how to fix the issue "Command /bin/sh failed with exit code 1" in iphone

iphone shell ios6 xcode4.5 build-error

I used a cocoa static library in my application. When I compile my library I got the following error:

Python strptime() and timezones?

python datetime timezone

I have a CSV dumpfile from a Blackberry IPD backup, created using IPDDump.