简体   繁体   English

嵌入Unicode字体

[英]Embedding Unicode Fonts

I made a cross-stitch pattern generator, which is live here: http://xstitch.zachrattner.com/ 我制作了一个十字绣图案发生器,该发生器位于此处: http : //xstitch.zachrattner.com/

Some of the people who use it say that once a pattern is generated, they can't see the Unicode symbols rendered in the pattern. 一些使用它的人说,一旦生成了模式,就看不到模式中呈现的Unicode符号。 Here's the CSS I'm using in a sample fix to test an embedded font: 这是我在示例修补程序中用来测试嵌入式字体的CSS:

@font-face
{
    font-family: FreeSerif;
    src: url(Fonts/FreeSerif.ttf) format("truetype");
}

*
{
    font-family: FreeSerif;
    font-size: 24px;
}

Wikipedia lists the Unicode blocks that FreeSerif implements. Wikipedia列出了FreeSerif实现的Unicode块。 However, if you look at my sample page , some of the symbols won't render. 但是,如果您查看我的示例页面 ,某些符号将无法呈现。

Any ideas? 有任何想法吗? Thanks in advance. 提前致谢。

Just use CSS font priorities. 只需使用CSS字体优先级即可。

Information: http://htmlhelp.com/reference/css/font/font-family.html 信息: http : //htmlhelp.com/reference/css/font/font-family.html

Also set: 还设置:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

The pages now specify 现在页面指定

  • { font-family: Helvetica,Verdana,Tahoma,Arial,sans-serif; {字体家族:Helvetica,Verdana,Tahoma,Arial,sans-serif; } }

and this is not overridden for the large table containing the stitch pattern. 对于包含针迹花样的大表来说,这不会被覆盖。 It is quite possible that Helvetica exists in different versions, with varying character coverage; Helvetica很可能存在不同版本,字符覆盖范围也有所不同。 Mac specialists might know about this. Mac专家可能对此有所了解。 But in most computers of the world, there is no font under that name. 但是在世界上大多数计算机中,该名称下都没有字体。 On such computers, browsers will either use one of the other fonts, failing to display many of the characters as eg Verdana does not contain them, or (more usefully, and in accordance with CSS specs) scan thru the font list until they find one that contains the character being displayed and ultimately falling back to some system−dependent font. 在此类计算机上,浏览器将使用其他字体之一,而无法显示许多字符,例如Verdana不包含它们,或者(更有用的是,并且符合CSS规范)浏览字体列表,直到找到一个包含要显示的字符,并最终退回到某些系统相关的字体。

For better predictability and robustness, you could use 为了获得更好的可预测性和鲁棒性,您可以使用

td { font-family: "Arial Unicode MS", "Lucida Sans Unicode", "DejaVu Sans", "Quivira", "Symbola", "Code2000", ; td {font-family:“ Arial Unicode MS”,“ Lucida Sans Unicode”,“ DejaVu Sans”,“ Quivira”,“ Symbola”,“ Code2000”, } }

Cf. cf. to font coverage information: http://www.fileformat.info/info/unicode/char/25ec/fontsupport.htm But you would really need to check that each of the fonts you list contains all of the characters you use in the table. 字体覆盖率信息: http : //www.fileformat.info/info/unicode/char/25ec/fontsupport.htm但您确实需要检查列出的每种字体是否包含表中使用的所有字符。

Other options: 1) Use font embedding (font @face) for some suitable font for which embedding is allowed—but this would probably involve considerable overhead since any font that contains all those characters is probably big . 其他选项:1)将字体嵌入(font @face)用于允许嵌入的某些合适字体-但这可能会涉及相当大的开销,因为包含所有这些字符的任何字体都可能很大 2) Use small images instead of the special characters. 2)使用小图像代替特殊字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM