I want to add new font
in tinymce editor
which are display in font dropdown
and apply to editor text.
I try to add ttf font in fonts folder of advance themes skin folder and also add in editor_template.js
and add css in contect.css
for @font-face.
I got font name in fonts dropdown. But when i apply to any text no any font effect on that text.
What is actual problem i can't found. Hope this is path issue or other...
Adds CSS style editing support to TinyMCE, this will enable you to edit almost any CSS style property in a visual way. You simply need to load the "style" plugin and add the control "styleprops" to any toolbar.
I solved the issue,
Check all the possible issues below and fix them to add a font in TinyMCE editor.
Create fonts folder : tinymce/themes/advanced/
- if not exists.
"tinymce/themes/advanced/fonts/aphrodite_pro.ttf.
Add font in editor_template.js & editor_template_src.js
include in "theme_advanced_fonts"
Ex: theme_advanced_fonts: "Aphrodite Pro=aphrodite pro"
,
Maintain "theme_advanced_fonts"
font name sequence in above both js files.
Most important part: "Aphrodite Pro"
name is defined by us where "aphrodite pro"
is the name of the font.
Note this might not work in TinyMCE version 4 or higher. Check new documentation: https://www.tinymce.com/docs/configure/content-formatting/#font_formats
Using Google Fonts i've just achieve this issue using two lines (in TinyMCE initialization):
content_css: ['https://fonts.googleapis.com/css?family=Gugi'],
font_formats: 'Arial Black=arial black,avant garde;Gugi=Gugi, cursive;Times New Roman=times new roman,times;',
The new font is called Gugi and will appear between arial black and times new roman
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