给FCKEDITOR添加中文字体 枫

先在fckeditor文件夹下找说明文档,根据提示将下面代码复制到</head>标签中。

<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript">
   window.onload = function()
   {
    var oFCKeditor = new FCKeditor( 'content' ) ;
    oFCKeditor.BasePath = "/blog/fckeditor/" ;
    oFCKeditor.Height = 400;
    oFCKeditor.ReplaceTextarea() ;
   
   }
</script>

默认情况下,FCKEditor在进行文本编辑时,无法使用中文字体。

自个儿摸索了下,解决方法如下:

  1. 打开 fckconfig.js 文件

    找到如下的行:
    FCKConfig.FontNames   = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
    将其修改为:
    FCKConfig.FontNames   = '宋体;黑体;幼圆;楷体_GB2312;仿宋_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; 

    当当,这样还是不行,虽然发现编辑器的字体选项多了已添加的中文字体,但应用到文本上却发现没有任何作用!
    接着下一步 :)
  2. 打开editor/css/fck_editorarea.css 文件


    将:
    font-family: Arial, Verdana, sans-serif;
    修改为:
    font-family: 宋体, 黑体, 幼圆, 楷体, 仿宋, Arial, Verdana, sans-serif;

  3. 保存,刷新后将即可以使用中文字体了。
原文地址:https://www.cnblogs.com/mrray/p/1999012.html