javascript - How to add fonts into NicEdit? -
my website allows user write short stories. want can free format , style text, install nicedit that. nicedit has 9 default fonts; how add more?
this editor. use default code full panel control. 
very happy, i've added news fonts nicedit successful. post answer here, hope userful has same problem.
1.download font file, save in folder, in way 'css/font'
2.register in css file: add css file "customfonts.css" has content: (i use fugaz 1 download google font)
@font-face { font-family: "fugazone"; src: url('font/fugazone-regular.ttf'); src: url('font/fugazone-regular.ttf') format('truetype'); font-weight: normal; font-style: normal; } you may change path font file.
3.link css file in html form, before add nicedit.js lib:
<link rel="stylesheet" type="text/css" href="css/customfont.css" /> <script type="text/javascript" src="js/nicedit/nicedit_dev.js"></script> 4.open nicedit.js , find word "niceditorfontfamilyselect". see fonts list use in nicedit, add new font here font-family register in css:
sel : {'arial' : 'arial',..., 'fugazone':'fugazone'}, 5.tada... done!
p/s: when show content database, must sure webpage had load customfont.css.
Comments
Post a Comment