Hello.
I have used several hours now on implementing fonts to CKeditor and making them work, but without a 100% succes.
When I use CKeditor where Text format: Full HTML is chosen the added fonts are displayed with the corresponding style shown, so that works. The problem occurs when I save the page and want to see the page - the font style is standard Times New Roman or similar, even though when I edit the page the html code shows the font-style I actually chosen.
I have cleared the cache everytime I changed some of the code.
With the knowledge I have gathered through different pages, this is what I have done so far.
Code added to CKeditor's ckeditor.config.js
config.contentsCss = '/css/ckeditor-fonts.css';
config.font_names = 'AlexBrush-Regular/AlexBrush-Regular;' + config.font_names;
config.fontSize_sizes = '10/10px;11/11px;12/12px;16/16px;20/20px;24/24px;30/30px;36/36px;40/40px;44/44px;50/50px;60/60px;72/72px;80/80px;';
Then I have made my own .css used in the config file (ckeditor-fonts.css).
It should be noted that I have tried every font format (ttf, woff, eot, otf, svg).
Code added to ckeditor-fonts.css
@font-face {
font-family: 'AlexBrush-Regular';
src: url('../fonts/AlexBrush-Regular.ttf');
src: local('AlexBrush-Regular'), url('../fonts/AlexBrush-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Your help is much appreciated!
Comments
Anyone?
Anyone?
Is the topic so complicated?
Is the topic so complicated?
Make sure you have the @font
Make sure you have the @font-face code loading in your theme's frontend css. Ckeditor can use a separate css file than your theme.
-----------------------------------------------------
Bob @ Drupal Aid (https://www.drupalaid.com)
I'm not sure if I know how to
I'm not sure if I know how to do that, could you explain it to me?
Try to implement
Try to implement all ur fonts and style in a separate or style.css and declare it in Advance configuration in CKEditor as
config.contentsCss = '/your/path/to/css/'. It works for me. Try it and let me know.
Suresh.E
Am a Acquia Certified Developer--Life Knocks us down. we have to decide whether or not to get up--
I did that before I wrote
I did that before I wrote this post.
I have made my own css file with fonts. Next I included the path to CKeditor configuration -> edit -> css -> path in Drupal.
This does unfortunately not work, but funny that it does that for you. I can see the font in CKeditor, but it does not apply to the hp when I save the text.
Oh Ok
Oh Ok, This is what I did. I use the same style sheet for both CKeditor Css and Drupal content css. Now you can able to see the fonts in CKeditor and u can select the font and apply it. Once the u save the content, the Drupal content css (probably style.css) will apply automatically for ur CKeditor content.
If u use the same stylesheet for both ckeditor and drupal pages, u will not have this problem.
Sorry about my English.
Suresh.E
Am a Acquia Certified Developer--Life Knocks us down. we have to decide whether or not to get up--
It sounds like something I
It sounds like something I have tried once before, I will have a look at it again and let you know.
In the meantime I have made a workaround, writing the fonts I want directly in the content.
Cool
Cool. Will wait for u post
Suresh.E
Am a Acquia Certified Developer--Life Knocks us down. we have to decide whether or not to get up--
any update?
have you got any update?
I have be born to be mankind
how use drupal 8
hi
how can use for drupal 8
Please help me, thank you