![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/47284bc4-7ea8-4c86-8ced-3a1dabfb6283.jpg)
Foreword
In the last article, I introduced font files in TTF format to solve the problem of inconsistent font performance on various platforms.
But in fact, that is not the optimal solution, because the font file not only has TTF format, Common font formats include OTF, WOFF, and WOFF2.
Today, let me summarize the concepts related to the most common font formats for future reference You can make the best choice when using it.
TTF (TrueType Font)
TrueType is a computer outline font (curved stroke) type standard jointly developed by Apple and Microsoft.
The extension of this type of font file is.ttf , the type code is tfil.
The main strength of TrueType is that it can provide developers with information about font display, different fonts Advanced control of size, pixel level display and more.
The compatibility is as follows:
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/31dbacb7-1e8d-4b4b-9abe-348ef8f94436.jpg)
OTF (OpenType Font)
OpenType is a cross-platform font file format jointly developed by Adobe and Microsoft, also called Type 2 font. Its font format adopts Unicode encoding and is a font compatible with various languages Format.
OpenType is also an outline font, more powerful than TrueType, and supports more A platform, supports a large character set, and copyright protection. It can be said that it is a superset of Type 1 and TrueType.
The OpenType standard defines a suffix for OpenType file names:
< span style="color: #FF502C; --tt-darkmode-color: #A01B00;">.ttf< /span>.The main advantages of OTF are:
- Enhanced cross-platform functionality;
- better support the international character set defined by the Unicode standard;
- Support advanced printing control capabilities;
- The generated file size is smaller;< /li>
- Support adding digital signatures in character sets to ensure the integration of files.
Same OpenType font file It can be used in Mac OS, Windows and Linux systems. This cross-platform font library is very convenient for users to use, and users no longer have to worry about configuring font libraries for different systems.
OTF has the same compatibility as TTF.
WOFF (Web Open Font Format)
Web Open Font Format span> is a font format standard used by web pages. This font format was developed in 2009 and is now being standardized as a Recommendation by the World Wide Web Consortium's Web Fonts Working Group.
This font format not only effectively uses compression to reduce file size, but also does not include encryption Also free from DRM (Digital Rights Management) restrictions.
WOFF essentially includes sfnt-based fonts (such as TrueType, OpenType or Open font format), and these fonts are compressed by WOFF's encoding tools for embedding in web pages. This font format uses zlib compression, and the file size is generally 40% smaller than TTF.
The compatibility is as follows:
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/75bcda22-98fa-41b2-af77-1b4c251df40e.jpg)
WOFF2
Based on WOFF1, WOFF 2 standard further optimizes volume compression, requires less bandwidth, and can be quickly decompressed on mobile devices.
Compared to the Flate compression used in WOFF 1.0, WOFF 2.0 uses the Brotli method The compression performed has a higher compression ratio, so the file size is smaller.
The compatibility is as follows:
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/6a2cfef8-52bd-41f3-85ef-1ec2a67f4378.jpg)
Supplementary concepts
In the above concept,Type 1 font and Type 2 font, I will add them here Two related concepts.
Type 1 font
Introduced by Adobe in 1984 for use with its PostScript page description language, Type 1 fonts gained widespread use with the proliferation of PostScript-capable desktop publishing software and printers. In 1996, Adobe product and type development began to focus on the more widely used OpenType fonts, with less focus on Type 1.
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/899d93d8-1281-43d4-afbd-fa4117c9e478.jpg)
Type 2 font
Open Type fonts are also called Type 2 fonts. This name is actually produced to correspond to Type 1 fonts, which means it is a step further than Type 1.
Summary
Through the above concept, we can see:
- TTF has better compatibility, but its font file size is the largest.
- WOFF fonts have a smaller size than TTF fonts volume and better performance.
- WOFF 2 font is an upgrade to WOFF font .
So, if you don't consider In terms of compatibility, WOFF 2 is the most recommended font. This is why I said at the beginning of the article that using TTF is not the optimal solution. You can choose the appropriate font file according to your actual situation to achieve the purpose of performance optimization.
~
~ This is the end of this article, thanks for reading!
~
Learn interesting knowledge, meet interesting friends, and shape interesting souls!
Hello everyone, I am the author of 〖Programming Samadhi〗Hermit Wang, my official account is "Programming Samadhi", welcome to pay attention, I hope you can give me more advice!
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Related%20concepts%20of%20TTF%20TOF%20WOFF%20and%20WOFF2.html
评论列表(196条)
测试