Limit characterset of a Webfont?

2019-08-09 04:24发布

问题:

I wonder if it is possible to limit the characterset of an embedded webfont?

E.g. "Typekit" has an option in its "Kit Editor" where you can choose between All Characters or Default.

However in my case I don't use Typekit but a normal embedded webfont. The fontfiles are rather big due to the large amounts of characters.

Is there some "meta-tag" or "attribute" for the @font-face call to limit the charcterset to let's say "Latin-1"?

Thank you in advance, Matt

回答1:

@font-face simply tells the browser to use the font definition file(s) you provide, and it will download the whole thing. If the font file(s) are too big because they contain glyphs you don't actually use, you need to reduce the size of the definition files by removing (or rather, not including) glyphs. The web-font creation software I've used allows you to specify which characters are to be included.

Even if there were a way to tell the browser "Only use Latin-1" it would still have to download the whole file in order to throw part of it away.

[Note that if you subsequently call for a glyph you have omitted, your users will see a square, or question-mark-in-a-diamond. Been there, done that!]



回答2:

The Font Squirrel Font-Face Generator has a subsetting feature. Fully customizable if you use the Expert settings. http://www.fontsquirrel.com/fontface/generator