在TinyMCE编辑器中使用Braillie字体


Using Braillie Font in TinyMCE Editor

我很想知道如何在TinyMCE编辑器中使用盲文字体。目前,我想在Moodle中集成这一功能,Moodle使用TinyMCE作为默认编辑器。

我能为tinymce添加字体的唯一方法是编辑核心代码。

首先将字体文件复制到/theme/yourtheme/fonts/

/theme/yourtheme/style/fonts.css 中为您的字体创建一个css文件

@font-face {
    font-family:'yourfont';
    src:url('/theme/yourtheme/fonts/yourfont.eot') format('eot'),
        url('/theme/yourtheme/fonts/yourfont.woff') format('woff'),
        url('/theme/yourtheme/fonts/yourfont.ttf') format('truetype'),
        url('/theme/yourtheme/fonts/yourfont.svg#yourfont') format('svg');
    font-weight:normal;
    font-style:normal;
}

您还需要将上面的@font面复制到/theme/yourtheme/style/custom.css中,以便正确显示字体。

编辑/lib/editor/tinymce/lib.php,并将这两行添加到$fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist;行之后的function get_init_params()(这是在Moodle 2.5中)

    $contentcss .= ', /theme/yourtheme/style/fonts.css';
    $fontselectlist .= ';Your font=yourfont';

清除缓存/admin/purgecaches.php刷新浏览器,字体现在应该在那里。