如何在ExtJS应用程序中添加自定义字体? [英] How to add a custom font to an ExtJS app?

查看:83
本文介绍了如何在ExtJS应用程序中添加自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同事!

请提出建议,如何为ExtJS添加自定义字体,以便将其与应用程序一起加载,以防用户未在系统中安装该字体?

必须将其加载到哪个文件夹,以及在何处以及如何将其包含?

谢谢您的回答!

解决方案

您可以简单地将新字体文件添加到 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.

这篇关于如何在ExtJS应用程序中添加自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆