0

可以在没有互联网连接的情况下在本地网页(XAMPP)上使用下载的字体吗?我需要这个来查看字体,因为有些人可能买不起互联网连接,他们只使用他们的电脑来工作。

这是网络字体: http: //openfontlibrary.org/en/font/didact-gothic

我试过这个没有运气:http ://css-tricks.com/snippets/css/using-font-face/

提前致谢!!!!

编辑

我认为存储文件的地方是问题,因为我有这个 .css 并且没有工作。我所有文件的位置是/opt/lammp/htdocs

@font-face {
    font-family: 'DidactGothicMedium';
    src: url('didactgothic.eot');
    src: url('didactgothic.eot') format('embedded-opentype'),
         url('didactgothic.woff') format('woff'),
         url('didactgothic.ttf') format('truetype'),
         url('didactgothic.svg#DidactGothicMedium') format('svg');
}

p {
  font-family: 'Didact Gothic';
  font-weight: normal;
  font-style: normal;
  padding-left: 25px;
  padding-right: 25px;
} 

input {
  font-family: 'Didact Gothic';
  font-weight: normal;
  font-style: normal;
} 
4

2 回答 2

0

您必须使用 Web 字体工具包,您可以从http://convertfonts.com等网站下载,包括样式和字体文件,该字体将在本地开发中工作,但为此您首先需要一个 otf 或 ttf 文件用于下载 webkit 的字体。

只需创建一个字体文件夹,就像你有 css、js 文件夹一样,在你的 css 文件中只包含 /fonts/,比如

  @font-face { font-family: 'MuseoSans-100'; 
  src: url('fonts/museosans-100.eot'); 
  src: url('fonts/museosans-100.eot') format('embedded-opentype'), 
       url('fonts/museosans-100.woff') format('woff'), 
       url('fonts/museosans-100.ttf') format('truetype'), 
       url('fonts/museosans-100.otf') format('opentype'), 
       url('fonts/museosans-100.svg#MuseoSans-100') format('svg'); 
  } just an example

如果您的 css 文件在另一个文件夹中,请相应地更改 url

于 2013-10-15T13:01:00.847 回答
0

是的,这是可能的,如果你只是在浏览器中访问你的本地主机,它应该就像你将它移植到那里并使用你自己的 IP/域去那里一样工作。

如果该@font 不适合您,请确保 1)您使用 Chrome/Firefox(Internet Explorer 仅支持某些文件扩展名(我认为是 .otf)。

2)你有正确的路径设置!

另外,也许您的一些 html/css 代码可以帮助我们解决您的问题 :)

于 2013-10-15T12:04:05.303 回答