且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ExtJS应用程序中添加自定义字体?

更新时间:2023-11-24 13:57:46

您可以简单地将新字体文件添加到 myApp \ resources \ fonts 并将相应的CSS规则添加到 sass \ etc \all.scss (由于scebotari66)喜欢

  @ font-face {字体家族:Pragmatica;src:url(fonts/Pragmatica.ttf)format('truetype');} 

如果在ExtJS上传文件之前需要字体,则可以将CSS规则添加到自定义文件夹(例如 myApp \ resources \ css \ app.css ),并包含 app.css myApp \ index.html 中,例如< link rel ="stylesheet" type ="text/css" href ="resources/css/app.css"> 代码>.它与Sencha CMDs sencha应用程序构建一起很好地工作.

colleagues!

Please suggest, how to add a custom font to ExtJS so, that it would be loaded together with the applicaton, in case the user doesn't have this font installed in his system?

What folder must it be loaded to, and where and how should it be included?

Thank you for answers!

You can simply add new font files to myApp\resources\fonts and add corresponding CSS rules to sass\etc\all.scss (thanks to scebotari66) like

@font-face {
    font-family: Pragmatica;
    src: url(fonts/Pragmatica.ttf) format('truetype');
}

If you need your font before ExtJS upload its files you can add CSS rule to custom folder like myApp\resources\css\app.css and include app.css within myApp\index.html like <link rel="stylesheet" type="text/css" href="resources/css/app.css">. It works well with Sencha CMDs sencha app build.