Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize fonts in CKEditor?

Does anyone know how to customize (add or remove) fonts in the CKEditor 3.x series? I looked all over and I can't figure out how. Supposedly there is a /plugin/fonts folder but it does not exist in 3.5+ of CKEditor.

like image 877
kidcapital Avatar asked Jun 18 '11 02:06

kidcapital


People also ask

How do I set the default font family in CKEditor?

To change the default font for text to which a style has not been applied, open \CRM\WWWRoot\ckeditor\contents. css and edit the body section at the top of the file. The following example changes the default font to Courier New.

How do I set the default font family in CKEditor 4?

I have use the following code to set default font and font size in CKEditor 4: config. font_defaultLabel = 'Tahoma'; config. fontSize_defaultLabel = '24px';


1 Answers

The fonts in the font menu are configured using CKEDITOR.config.font_names:

<static> {String} CKEDITOR.config.font_names

The list of fonts names to be displayed in the Font combo in the toolbar. [...]

So all you need to do is set font_names in your configuration to the font names you want, for example:

config.font_names =
    'Arial/Arial, Helvetica, sans-serif;' +
    'Times New Roman/Times New Roman, Times, serif;' +
    'Verdana';

Will give you these font names in the menu:

  • Arial
  • Times New Roman
  • Verdana
like image 94
mu is too short Avatar answered Oct 12 '22 14:10

mu is too short