Baidu Editor is an editor that is often used in the development process. Because its functions are similar to Word, it is used by many developers to develop various projects. However, sometimes it encounters some special situations, such as small The editor recently encountered a client from a higher education institution who required that articles published on the website must be in imitation Song fonts or national standard imitation Song fonts, that is, "Imitation Song" and "Imitation Song GB2312", but the official version of Baidu Rich Text Editor is not available. The two fonts "Fang Song" and "Fang Song GB2312" are not provided.
After consulting various materials, the editor summarized how to add two fonts, "Fang Song" and "Fang Song GB2312", in Baidu Editor, as shown below.
First of all, before adding the two fonts "Fake Song" and "Fake Song GB2312", we need to know and understand how these two fonts are represented in the development application. The fonts in the official documents are As follows:
'songti':'宋体', 'kaiti':'楷体', 'heiti':'黑体', 'lishu':'隶书', 'yahei':'微软雅黑', 'andaleMono':'andale mono', 'arial': 'arial', 'arialBlack':'arial black', 'comicSansMs':'comic sans ms', 'impact':'impact', 'timesNewRoman':'times new roman'
It is not difficult to find that the use of fonts during the development process often has its own way of expression. Through searching, the editor summarized the ways in which some commonly used fonts are expressed during the development process, as follows Display:
华文细黑:STHeiti Light [STXihei] 华文黑体:STHeiti 华文楷体:STKaiti 华文宋体:STSong 华文仿宋:STFangsong 俪黑 Pro:LiHei Pro Medium 俪宋 Pro:LiSong Pro Light 标楷体:BiauKai 苹果俪中黑:Apple LiGothic Medium 苹果俪细宋:Apple LiSung Light 新细明体:PMingLiU 细明体:MingLiU 标楷体:DFKai-SB 黑体:SimHei 宋体:SimSun 新宋体:NSimSun 仿宋:FangSong 楷体:KaiTi 仿宋_GB2312:FangSong_GB2312 楷体_GB2312:KaiTi_GB2312 微软正黑体:Microsoft JhengHei 微软雅黑体:Microsoft YaHei 隶书:LiSu 幼圆:YouYuan 华文细黑:STXihei 华文楷体:STKaiti 华文宋体:STSong 华文中宋:STZhongsong 华文仿宋:STFangsong 方正舒体:FZShuTi 方正姚体:FZYaoti 华文彩云:STCaiyun 华文琥珀:STHupo 华文隶书:STLiti 华文行楷:STXingkai 华文新魏:STXinwei
From here, we can easily see that the display methods of "FangSong" and "FangSong GB2312" during the development process are: FangSong and FangSong_GB2312 respectively, so what we need to do next is Just add these two fonts to the corresponding locations in Baidu Rich Text Editor.
The process is as follows:
1. Find the file ueditor/lang/zh-cn/zh-cn.js, find the fontfamily node in it, add "imitate Song" and "Fake Song GB2312" fonts FangSong and FangSong_GB2312
'fontfamily':{ 'songti':'宋体', 'kaiti':'楷体', 'heiti':'黑体', 'FangSong ': '仿宋', 'FangSong_GB2312': '仿宋_GB2312', 'lishu':'隶书', 'yahei':'微软雅黑', 'andaleMono':'andale mono', 'arial': 'arial', 'arialBlack':'arial black', 'comicSansMs':'comic sans ms', 'impact':'impact', 'timesNewRoman':'times new roman' },
2. Find the file ueditor\ueditor.config.js (I also saw it on the Internet saying it is ueditor\editor_config.js, maybe a version problem), find it The commented out fontfamily node is about line 180. Remove the comment of this node and add the fonts FangSong and FangSong_GB2312
,'fontfamily':[ { label:'',name:'songti',val:'宋体,SimSun'}, { label:'',name:'kaiti',val:'楷体,楷体_GB2312, SimKai'}, { label:'',name:'yahei',val:'微软雅黑,Microsoft YaHei'}, { label:'',name:'heiti',val:'黑体, SimHei'}, { label: '', name: 'SimSun', val: '仿宋,SimSun' }, { label:'',name:'FangSong_GB2312',val:'仿宋_GB2312 ,FangSong_GB2312'}, { label:'',name:'lishu',val:'隶书, SimLi'}, { label:'',name:'andaleMono',val:'andale mono'}, { label:'',name:'arial',val:'arial, helvetica,sans-serif'}, { label:'',name:'arialBlack',val:'arial black,avant garde'}, { label:'',name:'comicSansMs',val:'comic sans ms'}, { label:'',name:'impact',val:'impact,chicago'}, { label:'',name:'timesNewRoman',val:'times new roman'} ]
of "Fake Song" and "Fake Song GB2312". This will appear when you edit the article again. There are two fonts: "Imitation Song" and "Imitation Song GB2312". Friends who need it can try it. I hope it will be helpful to you.
Related recommendations: "PHP Video Tutorial"
The above is the detailed content of How to add 'Fake Song' and 'Fake Song GB2312' in Baidu Editor. For more information, please follow other related articles on the PHP Chinese website!