I would like to add a font to the CKEditor font combo box. This in itself is easy enough. However the font I would like to add is a custom font that I use with the @font-face CSS3 attribute. I managed to do that but the editor itself does not show the custom font. If I just take the html created by CKEditor and show it in a div on the page, the custom font show nicely. I would also like to somehow add the @font-face attribute to the text area of CKEditor, so my users can see the custom font as they type.
Is this possible?
Configuring the font family featureUse the config. fontFamily. options configuration option to do so.
To change the default font for text to which a style has not been applied, open \CRM\WWWRoot\ckeditor\contents. css and edit the body section at the top of the file. The following example changes the default font to Courier New.
line_height="1em;1.1em;1.2em;1.3em;1.4em;1.5em" ; In this way, you'll have your custom values in dropdown and hence you can modify it accordingly.
add the following line to ckeditor/config.js
config.contentsCss = 'fonts.css'; //the next line add the new font to the combobox in CKEditor config.font_names = 'fontnametodisplay/yourfontname;' + config.font_names;
where fonts.css has the @font-face attribute:
@font-face { font-family: "yourfontname"; src: url( ../fonts/font.eot ); /* IE */ src: local("realfontname"), url("../fonts/font.TTF") format("truetype"); /*non-IE*/ }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With