Font-family attribute for default font

2 posts, 0 answers
  1. HSLaw
    HSLaw avatar
    153 posts
    Member since:
    Jan 2006

    Posted 06 Mar 2013 Link to this post


    How to enable the font family attribute for the default font?

    We have an editor for user to construct their email to send email newsletter.

    The default font is Arial so when user select Arial, it doesn't have the font tag.

    The problem comes when recipient receive the email in Outlook or other email clients that uses Times New Roman as default font.
    This will render the text as Times New Roman since there is no font-tag in the email.


  2. Rumen
    Rumen avatar
    13117 posts

    Posted 11 Mar 2013 Link to this post


    The problem that you experience is explained in the following KB article: No FONT tags are applied when I type text in the editor. The FontSize and FontName tools will not apply a font tag to the selected content, if the user selects the same font size and font name as the default one of the browser (content area).

    You can use the following code solution to wrap the initial content or the empty content of RadEditor in a span tag with Arial 14px, e.g.

    Copy Code
    <telerik:radeditor runat="server"OnClientLoad="OnClientLoad"ID="RadEditor1">
    <script type="text/javascript">
    function OnClientLoad(editor) {
    setTimeout(function() {
    var tool = editor.getToolByName("RealFontSize");
    var args = newTelerik.Web.UI.EditorCommandEventArgs("RealFontSize", null, "14px");"RealFontSize", args);"FontName", { value: "Arial"});
    }, 0);

    Another way is to wrap the obtained content on the server in a span tag having the desired font-size style in pixels, e.g.

    RadEditor1.Content = "<span style='font-family: Arial;font-size: 14px;'>" + RadEditor1.Content + "</span>";

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top