自定义字体不工作 [英] The custom font does not work.Codeigniter

查看:106
本文介绍了自定义字体不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程式中新增自订字型,但它不工作。
这里是字体所在路径

  @ font-face {font-family:PF Din Text Cond Pro; 
src:url('/ fonts / JtNLnKEa.ttf'); }

字体位于 system / fonts / JtNLnKEa



UPD

  @font -face {
font-family:PF Din Text Cond Pro;
src:url('http://contrast-energo.ru/fonts/JtNLnKEa.ttf');
}

body,html {
font-family:PF Din Text Cond Pro;
height:100%;
min-height:100%;
margin-top:0px;
}

如何解决?



对不起我的错误英语

解决方案

您的问题与CodeIgniter无关。您在CSS / HTML中有问题。



您需要使用以下CSS代码将字体正确添加到HTML文档:

  @ font-face {
font-family:'PF Din Text Cond Pro';
src:url('fonts / PF-Din-Text-Cond-Pro.eot');
src:url('fonts / PF-Din-Text-Cond-Pro.woff')格式('woff'),
url('fonts / PF-Din-Text-Cond- ttf')format('truetype'),
url('fonts / PF-Din-Text-Cond-Pro.svg')format('svg');
font-weight:normal;
font-style:normal;
}

自定义字体将显示在所有浏览器上。



如果您要将字体分配给 body 元素,您可以使用以下命令:

  body {font-family:'PF Din Text Cond Pro',Arial,sans-serif;} 
pre>

您需要在单引号或双引号之间添加字体名称,因为它是自定义字体。



如果您只有一个.otf或.ttf字体文件,那么您需要将此文件转换为其他格式。



在线字体转换器是最好的免费字体转换器。


I want to added custom font in my app, but it does not work. Here it is path when font located

@font-face {    font-family: PF Din Text Cond Pro;
                 src: url('/fonts/JtNLnKEa.ttf'); }

font located in system/fonts/JtNLnKEa

UPD

@font-face {
    font-family: PF Din Text Cond Pro;
        src: url('http://contrast-energo.ru/fonts/JtNLnKEa.ttf');
}

body,html { 
  font-family: PF Din Text Cond Pro;
  height: 100%; 
  min-height: 100%; 
  margin-top: 0px;
}

How fix?

Sorry for my bad English

解决方案

Your problem isn't related to CodeIgniter. You have a problem in the CSS/HTML.

You need to use the following CSS code to add properly your fonts to a HTML document:

@font-face {
    font-family: 'PF Din Text Cond Pro';
    src: url('fonts/PF-Din-Text-Cond-Pro.eot');
    src: url('fonts/PF-Din-Text-Cond-Pro.woff') format('woff'), 
         url('fonts/PF-Din-Text-Cond-Pro.ttf') format('truetype'), 
         url('fonts/PF-Din-Text-Cond-Pro.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

The custom font will be displayed on all the browsers.

In case you want to assign the font to the body element, you can use the following:

body {font-family:'PF Din Text Cond Pro', Arial, sans-serif;}

You need to add the font name between single quotes or double quotes, because it's a custom font.

In case you have only a ".otf" or ".ttf" font file, then you need to convert this file to the other formats.

Online Font Converter is the best free font converter out there.

这篇关于自定义字体不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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