Is it possible to use Web Fonts with ejRTE?
Hello,
Randy
I am curious if it's possible to integrate the font selections in ejRTE with Web Fonts such as Google Fonts. The result would be that the font selector would only show the web fonts available in the project and these could be applied to the text in the editor.
I see how to add fonts to the font selector list using the fontName member. What I don't know is if these fonts have to be installed on the local machine. or if the font name can refer to a web font used in the project.
Thank you,
Randy
SIGN IN To post a reply.
1 Reply
HP
Harikrishnan P
Syncfusion Team
July 21, 2015 02:52 PM UTC
Hi Randy,
Query: I see how to add fonts to the font selector list using the fontName member. What I don't know is if these fonts have to be installed on the local machine. Or if the font name can refer to a web font used in the project.
Thanks for using Syncfusion products.
To use web fonts in EJ RTE, it is not needed for the web fonts to be present in local machine. To add the web fonts to EJ RTE, we need to append the web font link to the RTE Iframe <head> tag. We can achieve this in the “create” event of the RTE as shown below.
|
$("#rteSample").ejRTE({ width: "550px", showFooter: true, fontName:fonts, create: function () { var $head = this._rteIframe.contents().find("head"); var url = "Styles/styles.css"; $head.append($("<link/>", { rel: "stylesheet", rel='nofollow' href: 'http://fonts.googleapis.com/css?family=Roboto', type: "text/css" })); $head.append($("<link/>", { rel: "stylesheet", rel='nofollow' href: 'http://fonts.googleapis.com/css?family=Great+Vibes', type: "text/css" })); } }); |
We have prepared an example sample to showcase this. Please check with the following link
http://jsplayground.syncfusion.com/wvgzynhq
In the above link you can see that we have added two Google web fonts (“Roboto” and “Great vibes”) to EJ RTE.
- 1 Reply
- 2 Participants
-
RC Randy Craven
- Jul 17, 2015 09:21 PM UTC
- Jul 21, 2015 02:52 PM UTC
8/13/2026 05:08:11 PM
Sun, 15 December 2024 03:30:00 UTC
Sun, 15 December 2024 03:30:00 AM
Wed, 16 Feb 2022 04:59:00 UTC