Posts: 5
Threads: 3
Joined: May 2020
Hello guys,
can anyone of you tell me, how I add a Font to the editor?
Sincerely yours
Cray
Posts: 515
Threads: 21
Joined: Feb 2019
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*/
}
Posts: 5
Threads: 3
Joined: May 2020
(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.
Posts: 44
Threads: 8
Joined: May 2014
2020-06-01, 18:51:02
(This post was last modified: 2020-06-01, 18:51:32 by smdp-1971.)
(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.
Posts: 5
Threads: 3
Joined: May 2020
(2020-06-01, 18:51:02)smdp-1971 Wrote: (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. Sorry, but i does not work for me. I changes the fontfamily of the editor, i will add a new custom font to the dropdown menu. Have you a another idea ?
Posts: 44
Threads: 8
Joined: May 2014
2020-06-02, 07:43:13
(This post was last modified: 2020-06-02, 07:44:56 by smdp-1971.)
(2020-06-01, 20:39:50)Cray Wrote: (2020-06-01, 18:51:02)smdp-1971 Wrote: (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. Sorry, but i does not work for me. I changes the fontfamily of the editor, i will add a new custom font to the dropdown menu. Have you a another idea ?
You want to change the font in ckeditor?
This example works fine for me.
I have this in gsconfig.php
PHP Code: # WYSIWYG toolbars (advanced, basic or [custom config]) define('GSEDITORTOOL', " ['About'],['ShowBlocks','CreateDiv'], ['Blockquote','SelectAll'], ['SpecialChar','Iframe'], ['Preview'], ['Source'], ['Templates'], ['Table'], ['Undo','Redo'], ['Maximize'],['Find'], '/', ['Bold','Italic','Underline','Strike'], ['NumberedList','BulletedList',''], ['Format'], ['JustifyLeft','JustifyCenter','JustifyRight'], ['Link','Unlink','Anchor','Layoutmanager'], ['Image','VideoDetector','Youtube','googlemaps','Thumb'] ");
# WYSIWYG Editor Options define('GSEDITOROPTIONS'," skin:'moono-lisa', uiColor:null, allowedContent:true, fillEmptyBlocks:false, startupOutlineBlocks:true, emailProtection:'encode', templates_replaceContent:false, format_tags:'p;h2;h3;h4', extraPlugins:'youtube,googlemaps,image2,autogrow,videodetector,html5video,liststyle', image2_alignClasses:['text-left', 'text-center', 'text-right'], image2_captionedClass:'image-captioned', contentsCss:'theme/editor.css', youtube_responsive:true, removePlugins : 'thumb,youtube', youtube_txtEmbed:false, fillEmptyBlocks:false ");
I don't understand where and how you added a new custom font to the dropdown menu!?
|