{"id":11531,"date":"2025-03-09T21:11:08","date_gmt":"2025-03-09T13:11:08","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11531"},"modified":"2025-03-09T21:11:08","modified_gmt":"2025-03-09T13:11:08","slug":"css-supports-font-tech-format","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2025\/03\/css-supports-font-tech-format\/","title":{"rendered":"CSS @supports\u89c4\u5219\u53c8\u65b0\u589efont-tech,font-format\u5224\u65ad"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11531\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11531<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u72ec\u7acb\u57df\u540d\u4e2a\u4eba\u7f51\u7ad9\u65e0\u9700\u6388\u6743\uff0c\u4f46\u9700\u8981\u4fdd\u7559\u539f\u4f5c\u8005\u3001\u51fa\u5904\u4ee5\u53ca\u6587\u4e2d\u94fe\u63a5\uff0c\u4efb\u4f55\u7f51\u7ad9\u5747\u53ef\u6458\u8981\u805a\u5408\uff0c\u5546\u7528\u8bf7\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/201901-css-var.jpg';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202503\/font-some-cover.jpg\" width=\"320\" height=\"204\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<p>\u7ee7\u7eed\u5173\u6ce8Web\u524d\u7aef\u524d\u6cbf\u65b0\u7279\u6027\uff0c\u8fd9\u6b21\u5feb\u901f\u4ecb\u7ecdCSS @supports\u89c4\u5219\u65b0\u589e\u52a0\u7684\u4e24\u4e2a\u7279\u6027\u5224\u65ad\uff0c\u4e00\u4e2a\u662f<code>font-tech()<\/code>\uff0c\u53e6\u5916\u4e00\u4e2a\u662f<code>font-format()<\/code>\u51fd\u6570\uff0c\u90fd\u6765\u770b\u770b\u662f\u4ec0\u4e48\u4f5c\u7528\u5427\u3002<\/p>\n<h3>\u4e00\u3001font-tech()\u7684\u529f\u80fd<\/h3>\n<p><code>font-tech()<\/code>\u51fd\u6570\u53ef\u4ee5\u68c0\u67e5\u6d4f\u89c8\u5668\u662f\u5426\u652f\u6301\u7528\u4e8e\u5e03\u5c40\u548c\u6e32\u67d3\u7684\u6307\u5b9a\u5b57\u4f53\u6280\u672f\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4e0b\u9762\u8fd9\u6bb5CSS\u4ee3\u7801\u53ef\u4ee5\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u652f\u6301COLRv1\u5b57\u4f53\uff08\u4e00\u79cd\u5f69\u8272\u5b57\u4f53\u6280\u672f\uff09\u6280\u672f\u3002<\/p>\n<pre>@supports font-tech(color-COLRv1) {}<\/pre>\n<p>\u4e0b\u8868\u5c55\u793a\u4e86\u53ef\u4ee5\u4f5c\u4e3a<code>font-tech()<\/code>\u51fd\u6570\u7684\u53c2\u6570\uff0c\u6570\u636e\u6e90\u81eaMDN\u6587\u6863\u3002<\/p>\n<p>5\u5e74\u524d\u7684\u8fd9\u7bc7\u6587\u7ae0\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/03\/css-emoji-opentype-svg-fonts\/\">\u5173\u4e8eCSS emoji\u5b57\u4f53\u548cOpenType-SVG\u6211\u6240\u77e5\u9053\u7684\u4e00\u4e9b\u4e8b<\/a>\u201d\u5bf9\u5176\u4e2d\u4e00\u4e9b\u5b57\u4f53\u6280\u672f\u6709\u8fc7\u7b80\u5355\u7684\u4ecb\u7ecd\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u4e86\u89e3\u4e0b\u3002<\/p>\n<table border=\"0\" width=\"100%\" class=\"params_table\" cellspacing=\"1\">\n<thead>\n<tr>\n<th align=\"left\">\u6280\u672f<\/th>\n<th align=\"left\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\"><strong>\u5f69\u8272\u5b57\u4f53\u6280\u672f<\/strong><\/td>\n<td align=\"left\"><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>color-colrv0<\/code><\/td>\n<td align=\"left\">COLR \u7248\u672c 0 \u5f69\u8272\u5b57\u4f53<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>color-colrv1<\/code><\/td>\n<td align=\"left\">COLR \u7248\u672c 1 \u5f69\u8272\u5b57\u4f53<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>color-svg<\/code><\/td>\n<td align=\"left\">SVG \u5f69\u8272\u5b57\u4f53<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>color-sbix<\/code><\/td>\n<td align=\"left\">\u6807\u51c6\u4f4d\u56fe\u56fe\u5f62\u5b57\u4f53<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>color-cbdt<\/code><\/td>\n<td align=\"left\">\u5f69\u8272\u4f4d\u56fe\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><strong>\u5b57\u4f53\u7279\u5f81\u6280\u672f<\/strong><\/td>\n<td align=\"left\"><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>features-opentype<\/code><\/td>\n<td align=\"left\">OpenType <code>GSUB<\/code> \u4ee5\u53ca <code>GPOS<\/code>\u6280\u672f<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>features-aat<\/code><\/td>\n<td align=\"left\">TrueType <code>morx<\/code> \u4ee5\u53ca <code>kerx<\/code> \u6280\u672f<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>features-graphite<\/code><\/td>\n<td align=\"left\">\u77f3\u58a8\u7279\u5f81\uff0c\u5373 <code>Silf<\/code>, <code>Glat<\/code>, <code>Gloc<\/code>, <code>Feat<\/code> \u4ee5\u53ca <code>Sill<\/code<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><strong>\u5176\u4ed6\u5b57\u4f53\u6280\u672f\u503c<\/strong><\/td>\n<td align=\"left\"><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>incremental-patch<\/code><\/td>\n<td align=\"left\">\u4f7f\u7528\u8865\u4e01\u5b50\u96c6\u65b9\u6cd5\u8fdb\u884c\u589e\u91cf\u5b57\u4f53\u52a0\u8f7d<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>incremental-range<\/code><\/td>\n<td align=\"left\">\u4f7f\u7528\u8303\u56f4\u8bf7\u6c42\u65b9\u6cd5\u589e\u91cf\u52a0\u8f7d\u5b57\u4f53<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>incremental-auto<\/code><\/td>\n<td align=\"left\">\u4f7f\u7528\u81ea\u52a8\u534f\u5546\u65b9\u6cd5\u7684\u589e\u91cf\u5b57\u4f53\u52a0\u8f7d<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>variations<\/code><\/td>\n<td align=\"left\">TrueType\u548cOpenType\u5b57\u4f53\u4e2d\u7684\u5b57\u4f53\u53d8\u5316\uff0c\u7528\u4e8e\u63a7\u5236\u5b57\u4f53\u8f74\u3001\u7c97\u7ec6\u3001\u5b57\u5f62\u7b49\u3002<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>palettes<\/code><\/td>\n<td align=\"left\">\u5b57\u4f53\u8c03\u8272\u677f\u6280\u672f\uff0c\u4e5f\u5c31\u662f\u901a\u8fc7font-palttle\u9009\u62e9\u5b57\u4f53\u4e2d\u7684\u8bb8\u591a\u8c03\u8272\u677f\u4e4b\u4e00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e8c\u3001font-format()\u7684\u4f5c\u7528<\/h3>\n<p><code>font-format()<\/code>\u8fd9\u4e2a\u6bd4\u8f83\u597d\u7406\u89e3\uff0c\u662f\u68c0\u6d4b\u6d4f\u89c8\u5668\u662f\u5426\u652f\u6301\u5236\u5b9a\u7684\u5b57\u4f53\u683c\u5f0f\u7684\u3002<\/p>\n<p>\u540c\u6837\u652f\u6301\u7684\u53c2\u6570\u503c\u548c\u5bf9\u5e94\u7684\u5b57\u4f53\u683c\u5f0f\u5982\u4e0b\u8868\u6240\u793a\uff1a<\/p>\n<table border=\"0\" width=\"100%\" class=\"params_table\" cellspacing=\"1\">\n<thead>\n<tr>\n<th align=\"left\">\u683c\u5f0f<\/th>\n<th align=\"left\">\u63cf\u8ff0<\/th>\n<th align=\"left\">\u6587\u4ef6\u540e\u7f00<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\"><code>collection<\/code><\/td>\n<td align=\"left\">OpenType\u96c6\u5408<\/td>\n<td align=\"left\"><code>.otc<\/code>, <code>.ttc<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>embedded-opentype<\/code><\/td>\n<td align=\"left\">\u5d4c\u5165\u5f0fOpenType<\/td>\n<td align=\"left\"><code>.eot<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>opentype<\/code><\/td>\n<td align=\"left\">OpenType<\/td>\n<td align=\"left\"><code>.ttf<\/code>, <code>.otf<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>svg<\/code><\/td>\n<td align=\"left\">SVG\u5b57\u4f53 (\u5df2\u5e9f\u5f03)<\/td>\n<td align=\"left\"><code>.svg<\/code>, <code>.svgz<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>truetype<\/code><\/td>\n<td align=\"left\">TrueType<\/td>\n<td align=\"left\"><code>.ttf<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>woff<\/code><\/td>\n<td align=\"left\">WOFF 1.0 (Web Open Font Format)<\/td>\n<td align=\"left\"><code>.woff<\/code><\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>woff2<\/code><\/td>\n<td align=\"left\">WOFF 2.0 (Web Open Font Format)<\/td>\n<td align=\"left\"><code>.woff2<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f7f\u7528\u793a\u610f\uff1a<\/p>\n<pre>@supports font-format(woff2) {\r\n  \/* \u6d4f\u89c8\u5668\u652f\u6301woff2\u5b57\u4f53 *\/\r\n}<\/pre>\n<h3>\u4e09\u3001\u946b\u8fa3\u70b9\u8bc4\u8fd9\u4e24\u4e2a\u7279\u6027<\/h3>\n<p>\u597d\uff0c\u8fd9\u4e24\u4e2a\u5b57\u4f53\u76f8\u5173\u7684\u68c0\u6d4b\u51fd\u6570\u7b97\u662f\u4ecb\u7ecd\u5b8c\u4e86\uff0c\u4e0b\u9762\u8fc7\u6765\u70b9\u8bc4\u4e0b\u3002<\/p>\n<p>\u76f4\u63a5\u8bf4\u7ed3\u8bba\uff1a\u6ca1\u7528\u7684\u5e9f\u7269\u7279\u6027\uff01<\/p>\n<p>\u4f46\u4e24\u8005\u7684\u5e9f\u7269\u4e4b\u5904\u5404\u6709\u4e0d\u540c\u3002<\/p>\n<p><code>font-tech()<\/code>\u662f\u68c0\u6d4b\u5b57\u4f53\u6280\u672f\u7684\uff0c\u8fd9\u4e2a\u5bf9\u4e8e\u4e2d\u6587\u573a\u666f\u5c31\u662f\u9e21\u808b\u7279\u6027\uff0c\u56e0\u4e3a\u4e2d\u6587\u5b57\u4f53\u662f\u4e0d\u4f1a\u4f7f\u7528\u8fd9\u7c7b\u6280\u672f\u7684\uff0c\u65e0\u4ed6\uff0c\u6210\u672c\u592a\u9ad8\u3002<\/p>\n<p>\u82f1\u6587\u5b57\u4f53\u5c31\u4e00\u4e9b\u5b57\u6bcd\u548c\u6570\u5b57\uff0c\u4f60\u91cc\u9762\u641e\u5f69\u8272\u5b57\u4f53\uff0c\u53d8\u4f53\u4e4b\u7c7b\u7684\uff0c\u6210\u672c\u662f\u53ef\u63a7\u7684\u3002<\/p>\n<p>\u4f46\u662f\u4e2d\u6587\u5b57\u4f53\uff0c\u5c11\u8bf4\u51e0\u5343\u4e2a\uff0c\u91cc\u9762\u518d\u9020\u5b57\u4f53\u7279\u5f81\uff0c\u53d8\u5f62\u4e4b\u7c7b\u7684\uff0c\u662f\u591a\u4e48\u6d69\u5927\u7684\u5de5\u7a0b\uff0c\u6240\u4ee5\uff0c\u76ee\u524d\u4e1a\u754c\uff0c\u81f3\u5c11\u5230\u73b0\u5728\u4e3a\u6b62\uff0c\u6211\u662f\u6ca1\u6709\u770b\u5230\u4e00\u5757\u6709\u5f69\u8272\u5b57\u4f53\u6216\u8005\u5b57\u4f53\u7279\u5f81\u7684\u4e2d\u6587\u5b57\u4f53\u7684\uff0c\u65e5\u6587\u5b57\u4f53\u5012\u662f\u6709\u3002<\/p>\n<p>\u800c<code>font-format()<\/code>\u51fd\u6570\u7684\u95ee\u9898\u5728\u4e8e\u51fa\u73b0\u7684\u592a\u665a\u4e86\u3002<\/p>\n<p>\u4f8b\u5982woff2\u5b57\u4f53\u7684\u68c0\u6d4b\uff0c\u8fd9\u4e2a\u6240\u6709\u73b0\u4ee3\u6d4f\u89c8\u5668\u90fd\u5df2\u7ecf\u652f\u6301\u4e86\uff0c\u8fd8\u6709\u68c0\u6d4b\u7684\u5fc5\u8981\u5417\uff0c\u6ca1\u4e86\uff0c\u6ca1\u6709\u610f\u4e49\u4e86\uff0c\u5c31\u597d\u50cf\u90fd\u5df2\u7ecf\u5c04\u5b8c\u4e86\uff0c\u624d\u4ece\u62bd\u5c49\u91cc\u7ffb\u51fa\u4e00\u4e2a\u5957\u3002<\/p>\n<p>\u6240\u4ee5\u554a\uff0c\u5927\u5bb6\u770b\u770b\uff0c\u4e86\u89e3\u4e0b\u6709\u8fd9\u4e48\u4e2a\u4e1c\u897f\u5c31\u597d\u4e86\u3002<\/p>\n<h4>\u4f46\u662f\uff0c\u5982\u679c\u629b\u5f00\u5176\u539f\u672c\u4f5c\u7528\u2026\u2026<\/h4>\n<p>CSS\u8fd9\u95e8\u8bed\u8a00\u5f88\u795e\u5947\uff0c\u5c31\u662f\u5f88\u591aCSS\u5c5e\u6027\u5927\u884c\u5176\u9053\u5e76\u4e0d\u662f\u56e0\u4e3a\u5176\u539f\u672c\u7684\u8bbe\u8ba1\u521d\u8877\uff0c\u800c\u662f\u5176\u884d\u751f\u7684\u7279\u6027\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8fd9\u91cc\u8fd9\u4e24\u4e2a\u51fd\u6570\uff0c\u5982\u679c\u629b\u5f00\u5176\u539f\u672c\u4f5c\u7528\uff0c\u5012\u4e0d\u662f\u6ca1\u6709\u4ef7\u503c\u53ef\u8a00\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528\u6b64\u51fd\u6570\u5224\u65ad\u5f53\u524d\u6d4f\u89c8\u5668\u662f\u4e0d\u662fSafari\u6d4f\u89c8\u5668\uff0c\u4f8b\u5982color-colrv1\u5f69\u8272\u5b57\u4f53\u6280\u672fSafari\u662f\u4e0d\u652f\u6301\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u501f\u6b64\u5224\u65ad\u5f53\u524d\u6d4f\u89c8\u5668\u3002<\/p>\n<pre>@supports not font-tech(color-COLRv1) {\r\n  \/* Safari\u6d4f\u89c8\u5668 *\/\r\n}<\/pre>\n<p>\u517c\u5bb9\u6027\u622a\u56fe\u793a\u610f\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202503\/2025-03-09_210039.png\" width=\"628\" height=\"291\" alt=\"v1\u7b97\u6cd5\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u662f\u4e0d\u662f\u8fd8\u633a\u6709\u8da3\u7684\uff1f<\/p>\n<p>\u597d\uff0c\u5c31\u626f\u8fd9\u4e48\u591a\u3002<\/p>\n<p>\ud83e\udd71\ud83d\ude34\ud83e\udd24<\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11531\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11531<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202503\/font-some-cover.jpg\" width=\"160\" height=\"102\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>CSS @supports\u89c4\u5219\u65b0\u589e\u4e24\u4e2a\u7279\u6027\u5224\u65ad\uff0c\u5206\u522b\u662ffont-tech()\u548cfont-format()\u51fd\u6570\uff0c\u90fd\u6765\u770b\u770b\u662f\u4ec0\u4e48\u4f5c\u7528\u5427~<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1842,1012,1109,1845,138],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11531"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=11531"}],"version-history":[{"count":8,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11531\/revisions"}],"predecessor-version":[{"id":11640,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11531\/revisions\/11640"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=11531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=11531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=11531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}