Search code examples
gwtfontssmartgwtrich-text-editor

smartGWT and RichTextEditor: How to set the available Fonts?


I am using the RichTextEditor from smartGWT and it comes with 7 different fonts by default, but I would like to support ONLY 1 font type, and not 7, but the font I want to support does not come with the RichTextEditor. How can I set the supported font types from the RichTextEditor?


Solution

  • It seems that they don't expose much of that functionality in the RichTextEditor API, however I believe it could be achieved by doing the following:

    RichTextEditor rte = new RichTextEditor();
    // remove the font controls
    rte.setControlGroups("formatControls", "styleControls", "colorControls");
    // set the base font for the editor, could also be done with a <span> tag
    rte.setValue("<font face="Bookman Old Style, Book Antiqua, Garamond"></font>");