http://www.jb51.net/article/109896.htm
Ueditor本身自帶11種字體
使用過程中這11種字體往往不能滿足我們的需求,現在我要添加“仿宋”和“仿宋GB2312”兩種字體
過程如下:
1、找到文件 ueditor/lang/zh-cn/zh-cn.js ,找到其中的fontfamily節點,添加“仿宋”和“仿宋GB2312”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
'fontfamily'
:{
'songti'
:
'宋體'
,
'SimSun'
:
'仿宋'
,
'FangSong_GB2312'
:
'仿宋_GB2312'
,
'kaiti'
:
'楷體'
,
'heiti'
:
'黑體'
,
'lishu'
:
'隸書'
,
'yahei'
:
'微軟雅黑'
,
'andaleMono'
:
'andale mono'
,
'arial'
:
'arial'
,
'arialBlack'
:
'arial black'
,
'comicSansMs'
:
'comic sans ms'
,
'impact'
:
'impact'
,
'timesNewRoman'
:
'times new roman'
},
|
2、找到文件ueditor\ueditor.config.js文件(網上也看到一說是ueditor\editor_config.js文件,可能版本問題),找到其中被注釋掉的fontfamily節點,去掉該節點的注釋,添加“仿宋”和“仿宋GB2312”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
//fontfamily
//字體設置 label留空支持多語言自動切換,若配置,則以配置值為准
,
'fontfamily'
:[
{ label:
''
, name:
'songti'
, val:
'宋體,SimSun'
},
{ label:
''
, name:
'SimSun'
, val:
'仿宋,SimSun'
},
{ label:
''
,name:
'FangSong_GB2312'
,val:
'仿宋_GB2312 ,FangSong_GB2312'
},
{ label:
''
,name:
'kaiti'
,val:
'楷體,楷體_GB2312, SimKai'
},
{ label:
''
,name:
'yahei'
,val:
'微軟雅黑,Microsoft YaHei'
},
{ label:
''
,name:
'heiti'
,val:
'黑體, SimHei'
},
{ 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'
}
]
//fontsize
//字號
//,'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36]
|
添加好的效果圖:
可以看到,仿宋和仿宋GB2312被成功添加上去了
最后,附上部分中文字體的英文名,方便添加字體
華文細黑: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