如何显示 GitHub 中不同粗细的 Noto Sans?

How to display Noto Sans in different weights from GitHub?

我无法显示不同粗细(细、普通、黑色)的 Noto Sans。我在 noto-fonts/unhinted 目录的 GitHub 上找到了 .ttf 文件。如何显示不同粗细的字体?

我正在开发 Google Chrome 版本 71.0.3578.98。

@font-face {
font-family: 'Noto Sans Thin';
font-weight:100;
font-style:normal;
src: url(https://github.com/googlei18n/noto- fonts/blob/master/unhinted/NotoSans-Thin.ttf?raw=true) format('truetype');
}

@font-face {
font-family: 'Noto Sans Regular';
font-weight:400;
font-style:normal;
src: url(https://github.com/googlei18n/noto-fonts/blob/master/unhinted/NotoSans-Regular.ttf?raw=true) format('truetype');
}

@font-face {
font-family: 'Noto Sans Black';
font-weight:900;
font-style:normal;
src: url(https://github.com/googlei18n/noto-fonts/blob/master/unhinted/NotoSans-Black.ttf?raw=true) format('truetype');  
}

.thin{
font-family:'Noto Sans Thin';
}
.black{
font-family:'Noto Sans Black';
}
.regular{
font-family:'Noto Sans Regular';
}


<p class="thin">Thin</p>
<p class="regular">Regular</p>
<p class="black">Black</p>

Thin 和 Regular 在视觉上没有区别。我想得到与此处相同的结果:https://www.google.com/get/noto/#sans-lgc

简而言之,github 不允许将托管在其服务器上的嵌入文件用于其他域。他们有严格的 CORS 政策,并且已经说得很清楚了。

如果您想使用这些文件,您需要将它们上传到您的服务器,然后 link 相应地上传它们。

所有 Noto 字体都在 SIL Open Font License (OFL) v1.1 下发布,您可以根据需要复制、修改和重新分发它们。