How do I change the Font Style in ACE editor?

后端 未结 2 1881
小蘑菇
小蘑菇 2021-02-05 06:07

I am using ACE editor on my page,




        
相关标签:
2条回答
  • 2021-02-05 06:35

    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
    
    0 讨论(0)
  • 2021-02-05 07:00

    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.

    0 讨论(0)
提交回复
热议问题