We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

RichTextEditor - Fonts - Default & Different

Is there anyway to
a) Set the default font, so it's not Times New Roman
b) Add my own fonts/remove the existing? as an example - I'd like to get rid of the Times New Roman entirely.

Thanks

Chris

6 Replies

VR Varalakshmi R.S Syncfusion Team March 25, 2013 11:58 AM UTC

Hi Chris,

 

Thanks for contacting Syncfusion forums.

 

Currently we do not provide support to remove the font names from font combo box. However, you can set fonts other than TimesNewRoman by using the following code snippet,

<code>

[Script]

//On load function

$find('RichTextEditor1').IFrame.ExecuteCommand(' fontName', 'Calibri'); // RichTextEditor1 refers control id

</code>

 

Kindly try the above given solution and let us know if this helps.

 

Regards,

Varalakshmi


CS Chris Skardon March 27, 2013 03:10 PM UTC

I'm struggling to get the script to work, I'm using the RichTextEditor in an MVC4 Razor view, like so:


@Html.Syncfusion().RichTextEditor("description").ShowHtmlSource(false).Width(500)

given a <script> </script> tag, what should I put in there? I've tried:
$.find('#description').iframe but that is null...

Thanks

Chris


HK Halvor Kalleberg April 2, 2013 12:52 PM UTC

Did you ever get this to work ? I'm struggling to change the default font too :(.


VR Varalakshmi R.S Syncfusion Team April 5, 2013 04:08 AM UTC

Hi Halvor,

 

We regret for the delay in getting back to you.

 

We have updated our solution for this query in the incident #106477. Kindly refer the above specified incident for better follow up.

 

Regards,

Varalakshmi



KB Kerry Bennett July 23, 2013 06:32 AM UTC

Can you please supply the solution to the above.
I also require the entered text to match with the font styles of the application.

I have tried the jquery in the thread and simialr with no success.

It looks like the stylesheet for the  "RichTextEditor_IFrame" sets the font-family.
But this is not inherited by the document in the IFrame.
So a different approach is required.
I have tried to set the style of the body of the document in the Iframe using jquery,
but have had no success.
It would be good if in future versions the document "body"  in IFrame had an id or a class,
then we could use a style sheet to control the font etc.

 


VR Varalakshmi R.S Syncfusion Team July 29, 2013 09:13 AM UTC

Hi Kerry,

Thanks for the update.

We suggest you to use the below given code to achieve the required functionality. The below given code will the Arial font face with size 2 for IFrame contents.

<code>

[script]

//function

var fontsize = $find('sample_FontSize_DropDown'); // here sample is controlid

var fontstyle = $find('sample_FontStyle_DropDown');

fontsize._textBox.value = 2; // fontsize for display purpose.

fontstyle._textBox.value = 'Arial'; // fontname for display purpose.

var rteobj = $find('sample_IFrame');

var str1 = rteobj.get_Text(); // getting the user text

var strhtml= '<div >'+'<font face="Arial" size="2">'+str1+'</font>'+'</div>'; // Div tag to pass the html source

rteobj.set_HtmlString(strhtml); // passing the Html element to RichTextEditor

</code>

Regards,

Varalakshmi


Loader.
Live Chat Icon For mobile
Up arrow icon