我正在努力将孟加拉语(Bānglā)Unicode字体嵌入我的网站几天,我尝试了很多东西.甚至我为@ font-face提供了一些很棒的解决方案,比如unicode-range(see deceze’s answer).我甚至尝试过所谓的Bulletproof @font-face Syntax Tutorial by Paul Irish.但最终发现字体嵌入看起来很有效,但实际上根本不起作用.如果我从PC(/ windows / fonts)删除Bānglā字体,那么我的浏览器无法从系统加载字体,并且它无法正常工作.我用于@ font-face的是:
@font-face {
font-family: 'Siyam Rupali';
src: url('fonts/siyamrupali-webfont.eot');
src: url('fonts/siyamrupali-webfont.eot?#iefix') format('embedded-opentype');
src: local('Siyam Rupali Regular'),local('Siyam Rupali'),url('fonts/siyamrupali-webfont.woff') format('woff'),url('fonts/siyamrupali-webfont.otf') format('opentype'),url('fonts/siyamrupali-webfont.svg#siyam_rupaliregular') format('svg');
font-weight: normal;
font-style: normal;
unicode-range: U+0980-09FF; //Bengali Range (source: http://www.unicode.org/charts/PDF/U0980.pdf)
}
不管怎么说,我从网上下载了Siyam Rupali字体(忘了我害怕的来源),然后使用FontSquirrel的@ font-face生成器创建了webfonts.
我把字体称为:
body{
font-family: "Siyam Rupali",Cambria,serif;
}
结果:不工作!!!
@font-face { font-family: 'Siyam Rupali';
src: url('https://bits.wikimedia.org/static-current/extensions/UniversalLanguageSelector/data/fontrepo/fonts/SiyamRupali/SiyamRupali.eot?version=1.070');
src: local('Siyam Rupali'),url('https://bits.wikimedia.org/static-current/extensions/UniversalLanguageSelector/data/fontrepo/fonts/SiyamRupali/SiyamRupali.woff?version=1.070') format('woff'),url('https://bits.wikimedia.org/static-current/extensions/UniversalLanguageSelector/data/fontrepo/fonts/SiyamRupali/SiyamRupali.ttf?version=1.070') format('truetype');
font-style: normal;}
然后我相应地实现了我的CSS.但仍有问题.然后我复制了bn.wiki中使用的文件的路径:
> SiyamRupali.eot – (Wikimedia path)
> SiyamRupali.woff – (Wikimedia path)
> SiyamRupali.ttf – (Wikimedia path)
并下载了确切的字体.之后我发现了一些不必要的大小不匹配,我使用的是字体版本.
+=====================+====================+ | PREVIoUS FILE SIZES | BN.WIKI FILE SIZES | +=====================+====================+ | EOT : 23KB | EOT : 144KB | | TTF : 47KB | TTF : 392KB | | WOFF : 26KB | WOFF : 166KB | | SVG : 71KB | [NO SVG] | +=====================+====================+
我认为这可以使正确的字形有所不同.所以只需用新下载的版本替换我的字体.最后一点代码:
@font-face {
font-family: 'Siyam Rupali';
src: url('fonts/SiyamRupali.eot?version=1.070');
src: local('Siyam Rupali'),url('fonts/SiyamRupali.woff?version=1.070') format('woff'),url('fonts/SiyamRupali.ttf?version=1.070') format('truetype');
font-style: normal;
unicode-range: U+0980-09FF; //Bangla Range (source: http://www.unicode.org/charts/PDF/U0980.pdf)
}
它就像一个魅力!我并不关心IE6,因为即使是防弹,它也是愚蠢的! :(我测试了Firefox 20.0,Opera 10.10和Chrome 30.0.1599.101 m.
字体Siyam Rupali现在可通过开发者社区获得:
感谢Tanbin Islam Siyam(Potasiyam)的精彩字体:Siyam Rupali.
编辑
以下列表可以很好地概述孟加拉语(Bānglā)Unicode可用性的改进现状:
> Language Support Status – Indic Language Support : MediaWiki.org
编辑2
我找到了unicode-range:导致Chrome出现问题.由于Siyam Rupali是一个非常好的字体,有大量的字形,我们不必提及范围.所以,你可以避免unicode-range:U 0980-09FF;. 原文链接:https://www.f2er.com/css/427476.html