Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add font family to the editor
#4
(2020-06-01, 02:30:09)Cray Wrote:
(2020-05-31, 18:57:19)Felix Wrote: Hi,

Add the following line to ckeditor/config.js
Code:
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:
Code:
@font-face {  
   font-family: "yourfontname";  
   src: url( ../fonts/font.eot ); /* IE */  
   src: local("realfontname"), url("../fonts/font.TTF") format("truetype"); /*non-IE*/  
}
Sorry, but it didn't work for me.

Try this solution with google fonts...

1. Create css file - editor.css and save in your theme folder.
2. In editor.css add and save.

Code:
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

@import url(https://fonts.googleapis.com/css?family=Roboto:400,500,700,300&subset=latin,latin-ext);

body
{
    /* Font */
    /*font-family: sans-serif, Arial, Verdana, "Trebuchet MS";*/
    font-family: 'Roboto', sans-serif;
    font-size: 12px;

    /* Text color */
    color: #333;

    /* Remove the background color to make it transparent */
    background-color: #fff;

    margin: 20px;
}

.cke_editable
{
    font-size: 13px;
    line-height: 1.6;

    /* Fix for missing scrollbars with RTL texts. (#10488) */
    word-wrap: break-word;
}

blockquote
{
    font-style: italic;
    font-family: Georgia, Times, "Times New Roman", serif;
    padding: 2px 0;
    border-style: solid;
    border-color: #ccc;
    border-width: 0;
}

.cke_contents_ltr blockquote
{
    padding-left: 20px;
    padding-right: 8px;
    border-left-width: 5px;
}

.cke_contents_rtl blockquote
{
    padding-left: 8px;
    padding-right: 20px;
    border-right-width: 5px;
}

a
{
    color: #0782C1;
}

ol,ul,dl
{
    /* IE7: reset rtl list margin. (#7334) */
    *margin-right: 0px;
    /* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/
    padding: 0 40px;
}

h1,h2,h3,h4,h5,h6
{
    font-weight: normal;
    line-height: 1.2;
}

hr
{
    border: 0px;
    border-top: 1px solid #ccc;
}

img.right
{
    border: 1px solid #ccc;
    float: right;
    margin-left: 15px;
    padding: 5px;
}

img.left
{
    border: 1px solid #ccc;
    float: left;
    margin-right: 15px;
    padding: 5px;
}

pre
{
    white-space: pre-wrap; /* CSS 2.1 */
    word-wrap: break-word; /* IE7 */
    -moz-tab-size: 4;
    tab-size: 4;
}

.marker
{
    background-color: Yellow;
}

span[lang]
{
    font-style: italic;
}

figure
{
    text-align: center;
    border: solid 1px #ccc;
    border-radius: 2px;
    background: rgba(0,0,0,0.05);
    padding: 10px;
    margin: 10px 20px;
    display: inline-block;
}

figure > figcaption
{
    text-align: center;
    display: block; /* For IE8 */
}

a > img {
    padding: 1px;
    margin: 1px;
    border: none;
    outline: 1px solid #0782C1;
}

3. Open gsconfig.php and edit

Code:
# WYSIWYG Editor Options
define('GSEDITOROPTIONS',"

contentsCss:'theme/editor.css'
");

4. Save gsconfig.php.
5. Open admin page and check if it works.
6. If the change is not visible, try clearing cache with ctrl + f5.
Reply


Messages In This Thread
Add font family to the editor - by Cray - 2020-05-31, 03:37:53
RE: Add font family to the editor - by Felix - 2020-05-31, 18:57:19
RE: Add font family to the editor - by Cray - 2020-06-01, 02:30:09
RE: Add font family to the editor - by smdp-1971 - 2020-06-01, 18:51:02
RE: Add font family to the editor - by Cray - 2020-06-01, 20:39:50
RE: Add font family to the editor - by smdp-1971 - 2020-06-02, 07:43:13



Users browsing this thread: 1 Guest(s)