The Font Name dropdown of Rich Text Editor by default displays a predefined set of font names. You can create your own font name list programmatically or by editing the static configuration file: richtexteditor\dialogs\setfontname.xml.

Online demo:

Dynamically populate the dropdown menu

The source code of this example can be found in the download package.

How to disable Font Name dropdown?

RichTextEditor allows you disable individual toolbar icons using Editor.DisabledItems property. If you want to disable the Font Name Dropdown, you can add "fontname" into Editor.DisabledItems list.


<RTE:Editor runat="server" ID="Editor1" DisabledItems="fontname" />

Edit the setfontname.xml file

The setfontname.xml file can be found in the richtexteditor/config folder. In setfontname.xml file you can find the following code which defines the font names information within RichTextEditor.

Here is the default font name setting:

var namelist=editor._config.fontnamelist||'Arial,Verdana,Tahoma,Segoe UI,Sans-Serif,Comic Sans MS,Courier New,Georgia,Impact,Lucida Console,Times New Roman,Trebuchet MS,Monospace';

Edit the client side configuration file

Configuration for RichTextEditor can be set in the client side in conjunction with server side settings. The client-side settings are collected in a javascript file (richtexteditor\scripts\config.js). Unlike server side settings change configuration specifically for that instance of the Editor, the client-side settings will apply all instances of your editor objects.

Here is the font name default setting:

fontnamelist	:	'Arial,Verdana,Tahoma,Segoe UI,Sans-Serif,Comic Sans MS,Courier New,Georgia,Impact,Lucida Console,Times New Roman,Trebuchet MS,Monospace',

Use server side method

The modifying in the client side configuration file will apply all instances of your editor objects. However when you upgrade your RTE with newer versions, this file may be overwritten. To avoid losting the changes, we suggest you use the following server side method:


Editor1.SetConfig("fontnamelist", "Arial,Verdana");

Use client side method

It is also very easy to overwrite the configuration using client side method.


<script type="text/javascript">
    var editor;
    function RichTextEditor_OnLoader(loader) {
        var config = loader._config;

        //set font name list by javascript code
        config.fontnamelist = "Arial,Verdana";
    }
</script>

Send feedback about this topic to CuteSoft. © 2003 - 2018 CuteSoft Components Inc. All rights reserved.